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
John Levy
1,451 PointsHaving trouble highlighting elements in the menu
I am having trouble highlighting elements in the menu. I want the page I am on either beginner, advanced or bundle to stay highlighted when I am that page. Right now it does not stay highlighted. It works if I just have the CSS code on lines 80-86 but when I add the rest of the code the beginner button does not stay highlighted. How do I keep the beginner button stay highlighted when on that page? I have attached my code below. http://codepen.io/Johned22/pen/wzAxOm Thanks in advance
1 Answer
Jason Anello
Courses Plus Student 94,610 PointsHi John,
For general styling of the links you're using the selector #menu a and you're using .active to change the background for the current page.
An id selector has greater specificity than a class so it will not override the background color. You need to at least match the specificity or exceed it if you want to override an earlier selector.
You can use #menu .active. Make sure you have a space between the 2.
You also have to do the same for the hover selector. #menu a:hover