Hi there,
I would like to apply a CSS background-image to top-level menu items only.
Is there a CSS snippet available that would show how to do this?
I noticed each item has a unique id that could be used but I was wondering if there is a generic style class / id etc that can be used to apply a style to all nice menu top level elements only.
Comments
Comment #1
davidwhthomas commentedNo response? I've used the id values for the top menu items to style them, though that's not a good solution because if the client adds new menu items, they will be unstyled and broken. There must be a way to style the top elements only but the CSS looks rather complicated.
Comment #2
lonehorseend commentedActually there is . . .
If you look at the CSS, there are varying levels of UL and li items.
ul.nice-menu li is for the striaght (no sub menu) top level items and ul.nice-menu-right li.menuparent:hover, ul.nice-menu-right li.over, and ul.nice-menu-right li.menuparent are for the vertical menus ones with arrows on the right. (Look for simliar stuff if you are doing horizontal and vertical left arrow facing ones. I'm pulling this from my theme css, so don't have the conventions for that the others currently handy.)
You have to then control the ones beneath these with ul.nice-menu-right ul, ul.nice-menu-right ul li, ul.nice-menu-right ul ul, ul.nice-menu-right li li.menuparent:hover, ul.nice-menu-right li li.over, and ul.nice-menu-right li li.menuparent . . . Again, remember to look for the convention that your particular direction uses.
Hope this helps!
Comment #3
davidwhthomas commentedThanks for the reply! :-)
That was a big help.
I ended up using the following CSS
It's definitely a good start and I hope it helps someone else too.
regards,
DT
Comment #4
ivrh commentedHi. This is a working example of nice_menu.css file used for horizontal menu which completely changes it.
Sizes of "ul li" and "a" elements are set to match picture dimentions and pictures are used as backgrounds.
Two last rules at the bottom are new and the rest of the file is commented original .css file.
Comment #5
add1sun commentedMarking this fixed since it seems resolved.
Comment #6
(not verified) commented