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

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

Setting the nav tab color/ anchor links to white w/o using the nav tag but just the "a" tag. Is is ok as well?

Hi, I tried to also change my nav links to white. I just used this code:
a { color: #fff; } and it did the job. But in Nick's video, he included the "nav" when he wrote the code so that it looks like this nav a {color: #fff;}. Will it matter if nav is not included and I just go straight to targeting the "a" tag?

1 Answer

Steven Parker
Steven Parker
231,275 Points

Without the "nav" in front, your selector will target every "a" element on the entire page. You may not notice a difference if all the "a" elements happen to be inside the "nav".

With the "nav" in front, only those "a" elements which are inside it are affected. If there are any elsewhere on the page they will be left alone.

Thank you so much for the response. I was actually thinking about that but I'm not sure if it's correct. Combining the 2 tags "nav" and "a" before the selector was the one that confused me at first.