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 trialweb pad
4,483 PointsIn selecting color to indicate which page the site visitor is in our webpage, I followed Nick's code, but when I clicke
I followed Nick's code and the Profile tab turned green which I think is what the purpose of the code is. But when I clicked the About tab/link, it did not turn green. Same with the Contact link.
- So does it only work where it was written in the html part, where the class.selected is specified in, which is in the Portfolio part of the nav?
- But then I also tried putting the class="selected" in my About and Contact list in my index.html, but it just turned the colors automatically to green. I thought it will only turn green if we or the site visitor is currently on that page. Obviously my code is wrong. How will the computer know when to change the color when the site visitor is in a certain page? The code Nick showed only works for the Profile section. What code should I write so that it will also affect the About and Contact link? Thanks in advance.
1 Answer
Steven Parker
231,198 PointsI believe the purpose of the "selected" class is to highlight the page you are on. So that class would be given to a different value for each page.
It's possible that the different pages have not been constructed and/or the links to them have not been established yet at the point in the course you currently are. But to be sure, you'd need to post your code, or better yet make a snapshot of your workspace and post the link to it here.
web pad
4,483 Pointsweb pad
4,483 PointsThank you, that might just be the case. It might get clearer in the next videos.