Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS How to Make a Website Customizing Colors and Fonts Use Color in CSS

Does "a {text-decoration: none}" stop "nav a, nav a: visited {color: #fff}" from working if it comes first in the code?

The text decoration declaration on my links is listed first in the css document, the color declaration on my nav links is listed second. However, when I refresh my page to see if it worked, color of the links does not change to white like it should. I'm wondering what's causing the color declaration to not work

Joe Bruno
Joe Bruno
35,909 Points

Hello,

Could you post your css and html. Style sheets cascade - meaning rules declared later are executed over rules declared earlier. If you use the chrome dev tools (cmd + option + j on a mac), and you inspect an element, you will see which rules are being applied and which rules are being overridden. Also, sometimes issues like this arise due to failing to use the proper selector. For instance, if "nav" was actually a class - and thus should be ".nav." Post your code and myself and others will be able to help further.

Stephen O'Connor
Stephen O'Connor
22,291 Points

I would say no, 'text-decoration' affects whether or not a link has an underline, 'color' is to do with the colour of the link, the two are completely different and wouldn't affect each other, regardless of where they come in the cascade.

1 Answer

Keith Kelly
Keith Kelly
21,326 Points

The text-decoration property will not affect the color of your text only the decoration, like underlines or strikethroughs. When you are stating text-decoration: none on links you are essentially only removing the underline.

If the color property is not applying correctly to the text I would expect a typo or syntax error in the css code.

Can you post your code so we can take a look?