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

Re: first-letter tag soup

From: Peter S. Linss <peter@linss.com>
Date: Wed, 12 Jan 2000 08:55:26 -0800
Message-ID: <387CB1FE.42C19D2F@linss.com>
To: "L. David Baron" <dbaron@fas.harvard.edu>
CC: www-style@w3.org


"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 GMT

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