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
Why does only one of the navigation links get the class selection?
I'm doing the How to Make a Website exercise, and the teacher gives the class selection to one of the navigation links. Why doesn't he give it to the rest of the navigations? How does the browser know what to have selected? I know the class selector is in the css but in the html it chooses one link to style. Can somebody help me?
Well, you're writing static pages, so when you write the next page you assign the class to a different navigation link. In dynamically written pages you could assign the class based on the page itself. The class doesn't have to be assigned to the same navigation link on every page, you decide what link gets the class.
Grant Bates1,915 Points
When you create the other pages (about, contact) those pages will then get the classification and the index page will not. The other pages will copy the index.html as a starting point. This caused a problem for me too but eventually it will all be explained.
I believe the class is assigned to the link that corresponds to the current page so you can format the link slightly differently. (More advanced, you can create the class so that the link 'won't work' on the page so people don't click on the link to a page where they already are)