RE: [CSS2.1] :first-letter

> [Original Message]
> From: fantasai <fantasai@escape.com>
> Date: 10/11/2003 3:21:34 AM
>
>
>
S5.12.2<http://www.w3.org/TR/2003/WD-CSS21-20030915/selector.html#first-lett
er>
>
> Constitution
> ------------
>
> # Punctuation (i.e, characters defined in Unicode [UNICODE] in the
> # "open" (Ps), "close" (Pe), and "other" (Po) punctuation classes),
> # that precedes the first letter should be included, as in:
>
> What about punctuation immediately following the first letter?
> Imagine the following with a drop-caps effect:
>
>    M. Lafayette ést parti de France...
>
>    É? Nín shūo shénme? Wǒ tīng bù dǒng. Qĭng nín...
>
>    "A" is the first letter of the alphabet. Remarkably consistent
>     across scripts, it...
>
> There's also this degenerate case to consider:
>
>     "_", the underscore, was used on typewriters...
>
> The first *letter* is 't', but surely it should not be part of the
> :first-letter pseudo-element.
>
> And what of numbers? They're not letters, but...
>
>     67 million dollars is a lot of money.
>
> Should :first-letter hold the '6' or the 'm'?

The :first-letter pseudo-element is a simple creature
and trying to complicate if for CSS 2.1 does not strike
me as a good idea.  CSS 3 line does contain proposals
to address your concerns. Trying to do anything other
than possibly clarify how :first-letter works is not a good
idea IMO.

> Language-Specific Requirements
> ------------------------------
>
> # Some languages may have specific rules about how to treat certain
> # letter combinations. In Dutch, for example, if the letter
> # combination "ij" appears at the beginning of a word, both letters
> # should be considered within the :first-letter pseudo-element.
>
> The UA requirents wrt such combinations should be, IMO, more clearly
> expressed.

And here we have one of the fundament problems :first-letter has,
The proposed display:drop-initial given in CSS3 line puts such
decisions where they rightly belong IMO, with the author and not
the user agent.

>
S5.12.3<http://www.w3.org/TR/2003/WD-CSS21-20030915/selector.html#before-and
-after>
>
> Before and After
> ----------------
>
> # When the :first-letter and :first-line pseudo-elements are combined
> # with :before and :after, they apply to the first letter or line of
> # the element including the inserted text.
> #
> # Example(s):
> #
> # p.special:before {content: "Special! "}
> # p.special:first-letter {color: #ffd800}
> #
> # This will render the "S" of "Special!" in gold.
>
> /I/ think it should render the first letter of the paragraph itself
> in gold. Here's why:
>
>    H1:before {content:counter(chapno, upper-roman) ". "}
>    :first-letter {font-size: larger; color: #ffd800;}
>
>    <h1>Planes in Spain</h1>
>
> If this gives me
>
>     XII. Planes in Spain
>
> I would want the P in "Plane" to be affected, not the X in "XII".
>
> Not good enough? Try this:

Nope because such an effect can be achieved  in other ways
without using the bothersome :first-letter pseudo element.

>
>    BODY { margin-left: 8.5em; }
>
>    P { text-indent: 5%; }
>
>    :first-letter { font-size: larger;
>                    color: #ffd800; }
>
>    P.note:before { content: "Note:";
>                    margin-left: -8em;
>                    width: 7.5em;
>                    float: left;
>                    color: green; }
>
>    DIV.example:before { content: "Example";
>                         display: block;
>                         margin: 0.5em;
>                         margin-left: -2em;
>                         font-weight: bold; }
>
> Is it better that the N in "Note:" be gold or the first letter of the
> note itself?
> Is it better that the E in "Example" be gold or the first letter of
> the example's text?

:first-letter is one of those cute ideas that didn't get fully thought
thru before it was made part of the standard.   It doesn't handle
every case well and trying to make it, is more trouble than it is
worth. While one can argue, as you have, that it would be better
if :first-letter did not apply to the content of :before or after, That
has been the defined interaction since CSS 2 and changing
it now would not be a good idea.

> <http://fantasai.inkedblade.net/style/demos/first-letter/www-style>
>
> If I specifically want to make the N in "Note:" bigger, I should be
> able to do this:
>
>    P.note:before:first-letter { font-size: 110%; }
>
> /That/ makes sense.

It might make sense, but not so much more that a change
in the standard from CSS 2 is warranted.

Received on Monday, 13 October 2003 12:40:29 UTC