Re: what happens if first-line contains markup?

Scott E. Preece writes:

 >  From: lauren@sqwest.bc.ca (Lauren Wood)
 > | 
 > | The definition of the "first-line" pseudo-element states that it can
 > | only be attached to a block-level element, but not what happens if the
 > | first line of this block-level element (e.g. P) contains markup, e.g.
 > | EM. Is it ignored in favour of the "first-line" formatting? 

(I'm glad to see we're getting down to the details.)

No, EM is not ignored. Suppose we have the following:

  P:first-line { text-transform: uppercase }

  <P><EM>The</EM> first line of this paragraph is really weird.

In order to resolve this, we need to find the fictional tag sequence.
Reading from 2.4: 

  "Note that the 'first-letter' pseudo-element tags abut the content
  (i.e. the initial character), while the 'first-line' pseudo-element
  start tag is inserted right after the start tag of the element they
  are attached to."

(Arguably, the part about 'first-line' should be found under 2.3 also)

So, the fictional tag sequence is:

  <P><P:first-line><EM>The</EM> first line</P:first-line> ...

Style properties set on EM will therefore have a pretty good chance of
surviving since other properties (e.g. those set on P:first-line) will
be inherited and carry less weight.

 > Hmm.  Presumably the normal cascade order applies for determining which
 > applies, but there is a wrinkle: the spec doesn't seem to say clearly
 > how pseudo-elements are counted in the specificity calculation.  If you
 > assume they count the same as other elements, and the other factors are
 > the same, then whichever came last in the STYLE specification would
 > apply.

Good point, there should be a note about the specificity of
pseudo-elements. I agree that they should count like other element
names. For reasons stated above, I do not agree with your last
sentence: the cascading rules are not relevant here, inheritance is.



Hakon W Lie, W3C/INRIA, Sophia-Antipolis, France
http://www.w3.org/people/howcome  howcome@w3.org