Previous Message
Next Message

I don't want to casscade

Sent by Jono on 11 September 2005 21:09


On 9/11/05 10:24 AM, [EMAIL-REMOVED]" [EMAIL-REMOVED]> wrote:

>  I have the following dropdown,  the problem is I do not want the style
> ("home_button") to cascde down to the other list items. Is there a way of
> having sub styles of cascading for example li.1, li.2 which I could define
> seperate styles for and not have the rollover image.
> An example would be good.
> 
> 
> 
> 
> <li class="home_button"><a href="">Sunfishes</a>
>     <ul>
>       <li><a href="">Blackbanded»
>         sunfish</a></li>
>       <li><a href="">Shadow bass</a></li>
>       <li><a href="">Ozark bass</a></li>
>       <li><a href="">White crappie</a></li>
>   </ul>
> 

It has to cascade, that's what CSS does.  You can easily work around it by
declaring styles for the sub-lists that have a higher level of specificity.
For example, if home_button links are red with a rollover iamge...

li.home_button a:hover {
    color: red;
    background-image: url(../YourImage.gif) 50% left no-repeat;
    }

...and you'd like any sub list links contained by home_button to be green,
and have no background image appear on rollover; you'd do this:


li.home_button ul li a:hover {
    color: green;
    background-image: none;
    }

I think that is what you are looking for.  You can declare any styles with
more specificity in order to override what was previously declared.


______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: