Re: first-letter tag soup

"L. David Baron" wrote:

> Section 5.12.2 of CSS2 [1] says that first-letter pseudo-elements
> should include punctuation preceding the first letter of the paragraph.
> It also says that the formatting of the first-letter pseudo-element
> can be understood by placing a :first-letter element immediately
> around the first letter of the paragraph.  It gives the following
> example:
>
> # <P>
> # <SPAN>
> # <P:first-letter>
> # T
> # </P:first-letter>he first
> # </SPAN>
> # few words of an article in the Economist.
> # </P>
>
> However, what happens to markup like:
>
> <p>[<span>Text</span>]</p>
>
> Both the '[' and the 'T' should be included in the first-letter
> pseudo-element.  This can't form a tree structure.  So how is that
> pseudo-element formatted?  What inherits from what?  Where do borders
> and backgrounds go (on both the span and the first-letter)?
>
> The only solution I can think of would be that if such a thing were to
> happen, there should be no first-letter pseudo-element for that block.

Two other possible solutions are:
1)
<p><p:first-letter>[</p:first-letter><span><p:first-letter><span:first-letter>T</span:first-letter></p:first-letter>ext</span>]</p>

This solution follows the reasoning that, the illegal HTML (since inlines
cannot contain blocks):
<b>bold<p>paragraph</p>text</b>
becomes:
<b>bold</b><p><b>paragraph</b></p><b>text</b>
by a correcting parser/processor (ie: you close and re-propogate any spans
that can't span contained containers, and <p:first-letter> is morally a
span)

or
2)
<p><p:first-letter>[<span>T</span></p:first-letter><span>ext</span>]</p>

Which is how a correcting parser/processor would treat:
<p><bold>bold<div>div</b></div></p>
(ie: the <p:first-letter> is treated more like a block)

Peter

>
>
> -David
>
> [1] http://www.w3.org/TR/REC-CSS2/selector.html#first-letter
>
> L. David Baron    Sophomore, Harvard (Physics)    dbaron@fas.harvard.edu
> Links, SatPix, CSS, etc.     <URL: http://www.fas.harvard.edu/~dbaron/ >
> WSP CSS AC                      <URL: http://www.webstandards.org/css/ >

Received on Wednesday, 12 January 2000 11:56:46 UTC