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 Organize CSS with Comments

Zette Harbour
Zette Harbour
1,891 Points

selecting a state for nav links

Does anyone know why the syntax is nav a.selected not nav a:selected ?

nav a, nav a:visited { color: #000; }

nav a.selected, nav a:hover { color: #999

2 Answers

Ron McCranie
Ron McCranie
7,837 Points

because the only pseudo-classes for anchors (a) are link, visited, hover, and active. The reason you're having to use .selected is because that is the class applied to the element and not a "state" native to the browser.