W3C home > Mailing lists > Public > www-style@w3.org > November 2000

Re: pseudo-elements and *

From: Bert Bos <bert@w3.org>
Date: Sun, 5 Nov 2000 18:21:52 -0800 (PST)
To: Ian Hickson <ianh@netscape.com>
Cc: Daniel Glazman <glazou_2000@yahoo.fr>, fantasai <fantasai@escape.com>, www-style@w3.org
Message-ID: <14854.5174.823599.417502@meta.inria.fr>
Ian Hickson writes:
> On Sun, 5 Nov 2000, Daniel Glazman wrote:
> >>> P::first-line { color :red }
> >>> P { color : black }
> >> 
> >> No, because the ::first-line pseudo-element is only matched by the first,
> >> not the second. So the second takes precedence.
> > 
> > I see no evidence of that anywhere in the specification...
> > On the contrary, I think that the second rule should override
> > the first one.
> 
> Think about:
> 
>    P { content: 'hello'; }
> 
> ...or:
> 
>    H1 { border: solid; }
> 
> See also section 5.3.
> 
>  
> >>> It suggests that pseudo-elements have an impact on specificity...
> >> 
> >> This is actually unrelated, but they do (pseudo-elements have a
> >> specificity of 001).
> > 
> > Not in the actual CSS 2 Rec. . Pseudo-elements have 000 for
> > the moment (from section 6.4.3) :
> 
> Oh, right. This is a contradiction that I mentioned a a few months 
> back, see:

As long as there is only at most one pseudo-element per selector, it
doesn't matter whether you assign a specificity to them. Selectors
with a pseudo-element never compete with selectors without, because
they don't apply to the same elements.

    :first-line { color: red }   /* specificity 000 */
    #x1 #x2 { color: black }     /* specificity 200 */

    <div id=x1><div id=x2>Some text...

The first line will still be red.


> 
>    http://lists.w3.org/Archives/Public/www-style/1999Jan/0074.html
> 
> -- 
> Ian Hickson                                     )\     _. - ._.)       fL
> Netscape, Standards Compliance QA              /. `- '  (  `--'
> +1 650 937 6593                                `- , ) -  > ) \
> irc.mozilla.org:Hixie _________________________  (.' \) (.' -' __________
> 

-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos/                              W3C/INRIA
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Monday, 6 November 2000 01:21:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:06 GMT