I can't figure out the right css for the secondnav in this site. I tried many different versions but don't seam to work.

I'm looking to have the menus in the secondnav go black when hovered and go black when the respective page is active.

as of now this is the CSS I created:

#secondnav .secondnav_menu a:active {color:black;}
#secondnav li.page_item a:hover {color:black;}

the secondnav "Breads" is the only that changes to black when hovered.


any suggestions would be amazing! thank you in advance for your help!

4 answers

This was chosen as the best answer


try this instead:

#secondnav li.current-menu-item a{color:#000}


#secondnav li.page_item a{color:#000}

I copied the wrong bit from the source, sorry.

a:active is for the link that was last clicked if you return to the page with the back button or while it is clicked and not all browsers do waht you expect.

Your CMS adds a class for the current menu item, that's the class you need to use.

Answered about 8 years ago by Tony Crockford

Your CSS is way more specific than it needs to be, and you have the pseudo declarations in the wrong order.


#secondnav a:hover{color: #000}
#secondnav a:active{color:#000}

The order is best remembered with a mnemonic like LoVeHAte (for Link,Visited,Hover, Active) or Lord Vaders Former Handle Anakin for Link, Visited, Focus, Hover, Active.

The reason that only the Breads link goes black on hover is that you have li.page_item in your declaration and the class.page_item only gets added to the list item that represents the page you are on.

If you want that link to be black and to have the others go black on hover then use this:

#secondnav li.page_item a{color:#000}

Should all work.

Answered about 8 years ago by Tony Crockford

Thank you, that makes so much sense! The hover works but the active page doesn't change to black. ??

#secondnav a:hover{color: black}

#secondnav a:active{color: black}

Answered about 8 years ago by Antonella

Sorry I didn't realize I needed to add the page_item css too, now it all works!!!

thank you so much!

Answered about 8 years ago by Antonella