Welcome to the Treehouse Community
Looking to learn something new?
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)