Jump to content
Sign in to follow this  
pbakker22

Child-parent main nav CSS colors (#brandnav) difficulty

Recommended Posts

pbakker22

I'm experiencing CSS styling problems (again) with the main nav parent-child relationship (using #brandnav). See my previous topic, which was resolved: http://www.pagelines.com/forum/topic/8397 The above topic was resolved when I was using a 'default main menu setting' (in WP Dashboard: Appearance - Menus - Theme location - Primary Website Navigation: (left blank) Since then I had to create a custom main menu and selected that as the Primary Website Navigation. After I did this, the code for my previous solution didn't work anymore. I've tried recreating it, but I am stuck with an aspect of parent-child styling. Here's what I have now: ` /* hover color */ #brandnav a:hover {color:#000 !important;} /* sets the currently selected page to black color */ #brandnav .main-nav .current_page_item a {color: #000;} /* deselects other pages, I think.. */ #brandnav .main-nav .current_page_item ul li a {color: #757575;} / if a child menu is selected, this should set that child's parent menu to black - it does that, but it also makes the other child menus black */ #brandnav .current_page_ancestor a {color: #000;} ` My problem seems to lie in the last line of code. When a child menu is selected, the parent ought to stay selected (black font color) as well. However, although this last line of code does make the parent menu black, it ALSO makes the other child menus black, even though they aren't selected. I just want the selected child and its parent in black, while the other child menus don't change color. Could anyone please help me figure this out? I'm running out of hair to pull out..

Share this post


Link to post
Share on other sites
cmunns

Couldn't find the link to your site. Can you re-post?

Share this post


Link to post
Share on other sites
cmunns

Pieter, it appears to me to act as you want it. Both child and parent are black...but other children are not.

Share this post


Link to post
Share on other sites
pbakker22

Hi Adam, It doesn't work when I try it, because when I click on a child, the other children also turn black.

Share this post


Link to post
Share on other sites
kastelic

Hi Peter, try changing it do this:

#brandnav .current_page_ancestor>a {color: #000;}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×