W3C home > Mailing lists > Public > www-style@w3.org > February 1998

Re: !CSS2WD ERROR! in pseudo-element rules

From: Bert Bos <bbos@charlotte.inria.fr>
Date: Wed, 25 Feb 1998 00:40:45 +0100
Message-Id: <199802242340.AAA04957@charlotte.inria.fr>
To: Ian Hickson <exxieh@bath.ac.uk>
Cc: www-style@w3.org
Ian Hickson writes:
 > Hi guys,
 > 
 > [I] just noticed an error in the current CSS2 working draft (1). In section
 > 5.10 on pseudo-elements and pseudo-classes, it says "only one pseudo-element
 > can be specified per selector" (2). However, a bit lower down in section
 > 5.10.3 there is a statement which starts "When the :first-letter and
 > :first-line pseudo-elements are combined with :before and :after, ..." (3).
 > Surely these two statements are in conflict?

The word "combined" is misleading. It refers to a style sheet like
this:

    P:before {content: "para: "}
    P:first-letter {color: red}

Now what letter is red? The spec says it is the "p" of "para".

 > 
 > [W]hat is the reasoning behind the first statement? Consider the following
 > (technically illegal) code:
 >    P:first-letter:before { content: "[" }
 >    P:first-letter:after  { content: "]" }
 > [T]his could surely come in useful, but is not currently allowed if we
 > follow section 5.10. I presume, if it was allowed, that it should simply
 > insert square brackets around the first letter. The selector
 > "P:before:first-letter" might be more even useful, if it applies to the
 > first-letter of the inserted content. Where does the last paragraph of
 > 5.10.3 stand on this? It doesn't seem very clear as to what important the
 > order of the pseudo-elements would have.
 > [(A]nd, by extension, "P:before:first-letter:after" - a pseudo-element which
 > is inserted just after the first letter of the inserted text which comes
 > before the content of every paragraph!)
 > 
 > On a related note, look at the following rule
 >    P EM, P:first-line    { font-style: italic; }
 > and imagine what would happen to the following text:
 >    <P>This is <EM>the</EM> first line of text.</P>
 > The emphasised "the" would not be emphasised! What we need is
 >    P:first-line EM       { font-style: normal; }
 > but according to the last line of the selectors page (4) it is wrong,
 > because "Pseudo-elements must be specified at the end of a selector". Again,
 > I don't really understand the reasoning in this.

Yes, I agree there are useful cases, but on the whole this leads to
so many difficulties (in the specification as well as in the
implementations) that we think this is not in the scope of CSS.

 > 
 > 
 > APPENDIX: BIBLIOGRAPHY
 > (1) http://www.w3.org/TR/1998/WD-css2-19980128/
 > (2) last paragraph of
 > http://www.w3.org/TR/1998/WD-css2-19980128/selector.html#pseudo-elements
 > (3) last paragraph of
 > http://www.w3.org/TR/1998/WD-css2-19980128/selector.html#h-5.10.3
 > (4) last paragraph of
 > http://www.w3.org/TR/1998/WD-css2-19980128/selector.html#h-5.10.6
 > 
 > 
 > I should say, for those that will wonder, that the selectors page is my
 > favourite section of the current working draft. Now if only anyone supported
 > them...
 > 
 > --
 > Ian Hickson
 > -----BEGIN GEEK CODE BLOCK-----
 > Version: 3.12
 > GIT/M/S d- s+: a--- C++(+++)>$ U P L+ !E W++ N++ o? K? w++>+++ O- !M V- PS+
 > PE- Y+ PGP t 5+++>++++ X- R+++ tv b++(+++) DI D++ G e-(*)>+++++ h!()(--) y?
 > ------END GEEK CODE BLOCK------


Bert
-- 
  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 4 93 65 76 92               06902 Sophia Antipolis Cedex, France
  +33 (0)4 92 38 76 92 (<--- after 5 Jan 1998)
Received on Tuesday, 24 February 1998 18:41:57 GMT

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