[Solved]Each menu item different background colour?

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
uniqu3

Re: [Solved]Each menu item different background colour?

Post by uniqu3 »

correct, and then use css accordingly.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: [Solved]Each menu item different background colour?

Post by Dr.CSS »

Yes, and you don't need the menu- part if you don't want it...
twwitt
Forum Members
Forum Members
Posts: 149
Joined: Thu Aug 28, 2008 7:45 pm

Re: [Solved]Each menu item different background colour?

Post by twwitt »

Great. Thanks. It's working now, except for when the parent menu item has no child (e.g. just a single main page on the first level). Then, the color only shows when I hover over it. What am I missing here that would display a background color when there's a parent and children, but NOT when it's just a lone page?

#primary-nav .menu-about a
{background: #589a3e;}

#primary-nav li.menu-about li a
{color: #ffffff;}

#primary-nav .menu-about:hover
{background: #589a3e;}
twwitt
Forum Members
Forum Members
Posts: 149
Joined: Thu Aug 28, 2008 7:45 pm

Re: [Solved]Each menu item different background colour?

Post by twwitt »

I added back in: <a class='alias'> (in addition to <li class='alias'> and that allowed me to change the background for the menu item that didn't have any children. Hope this makes sense as a way to do it! Thanks for all your help.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: [Solved]Each menu item different background colour?

Post by Dr.CSS »

May I suggest some reading..?

http://www.w3schools.com/css/default.asp
twwitt
Forum Members
Forum Members
Posts: 149
Joined: Thu Aug 28, 2008 7:45 pm

Re: [Solved]Each menu item different background colour?

Post by twwitt »

Thanks. I'll try doing that again. I generally can make my way around many CSS, but I find menus to be extremely confusing (unlike other parts of CSS) in terms of what effects what. I haven't found http://www.w3schools.com/css/default.asp particularly helpful in that regard. But I'll try again so I don't have to be bugging you folks..
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: [Solved]Each menu item different background colour?

Post by Dr.CSS »

The style you use on the parent should trickle down to the children, hence "cascading style sheet"...

#primary-nav li.parent class a {bakground-color: }
Post Reply

Return to “Layout and Design (CSS & HTML)”