Here is a quick snippet of my CSS for the Main Menu:
[COLOR=“Blue”]#main li a{
background-image:url(site_images/nav_sprite.jpg);
background-repeat: no-repeat;
height:39px;
display: block;}
#main li a.home{background-position: 0px 0px; width:48px;}[/COLOR]
problem I’m having is, the submenu to one of the links is showing background-image:url(site_images/nav_sprite.jpg);
Is this because my #main li a also affects #sub’s li? This is how my html is structured.
<ul id=“main”>
<li><a></a>
<ul id=“sub”>
<li><a></a></li>
</li>
Stevie was saying use the child selector (>) so that you only target the immediate children of the ul but he forgot to add the next bit to target only the immediate child of the list element also (#main > li > a {}).
However IE6 doesn’t understand the child selector so if you want to support IE6 then use noonope’s version above which cancels out the background on deeper nested lists.