> On Oct 12, 2008, at 11:25 AM, Erik Harris wrote:
> 
> > I've got a <ul> element buried with this
> hierarchy:
> > ....div#sidebar > ul > li#pages > ul
> >
> > I've got the following two lines in my stylesheet:
> >
> > #sidebar ul ul {margin: 5px 0 0 10px;}
> > #pages ul {margin: 0em; padding: 0em;}
> >
> > Despite the fact that it seems that the second line
> should be more
> > specific (#pages is more specific because it's
> deeper in the  
> > hierarchy),

--- On Sun, 10/12/08, Philippe Wittenbergh <[EMAIL PROTECTED]> wrote:

> #sidebar ul ul : a=1 b=0 c=2 --> 102
> #pages ul a=1 b=0 c=1 --> 101
> 
> http://www.w3.org/TR/css3-selectors/#specificity

Just to expand on Philippe's brief (although totally correct) explanation:

CSS does not take hierarchy into account when calculating specificity, however 
illogical that might seem. The first rule 'wins' merely because of the 
additional 'ul'. You could rewrite that second selector "#sidebar #pages ul" to 
resolve this issue.

- Bobby


      
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to