W3C home > Mailing lists > Public > www-style@w3.org > September 2010

Re: Nested :first-letter

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 8 Sep 2010 18:24:36 -0700
Message-ID: <AANLkTimf4BUwS59DrCPj_BOvTXpcKq+4peZF7AzZYf+7@mail.gmail.com>
To: Simon Fraser <smfr@me.com>
Cc: fantasai <fantasai.lists@inkedblade.net>, "www-style@w3.org list" <www-style@w3.org>
On Wed, Sep 8, 2010 at 6:16 PM, Simon Fraser <smfr@me.com> wrote:
> On Sep 8, 2010, at 6:10 PM, fantasai wrote:
>
>> On 09/08/2010 05:36 PM, Simon Fraser wrote:
>>> What should be the rendering of the following?
>>>
>>> <style>
>>> div:first-letter { font-size: 24pt; }
>>> p:first-letter { color: red; }
>>> </style>
>>> <div><p>Text</p></div>
>>>
>>> Does the 'T' render in a 24pt font or not?
>>
>> Yes.
>>
>>> I don't see anything at <http://www.w3.org/TR/CSS2/selector.html#first-letter>
>>> that suggests one rendering over another.
>>
>> See the example containing
>>  <p><div:first-letter><p:first-letter>T</...></...>he first text.
>>
>> The "fictional tag sequences" in the spec are there to show how inheritance works.
>> In this case the div:first-letter font-size inherits through to the p:first-letter.
>
> I see now, thanks. Neither WebKit, Gecko nor Opera seem to get this right.

Right; they all generate a single ::first-letter pseudo.

It appears that Webkit only generates the pseudo for the innermost
element.  In this example, only the p generates a pseudo in Webkit.
In Firefox, an element won't generate a ::first-line pseudo at all if
its first text is inside a descendant block.


On Wed, Sep 8, 2010 at 6:20 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> Gecko has no support for nested first-letter or nested first-line.  It just
> uses whatever the innermost one is.

As far as I can tell, that's not quite true.  See above.  The effect
is similar in some circumstances, though, but it can be distinguished
if you take the spec example and remove the p::first-line rule - no
pseudo gets generated at all.

~TJ
Received on Thursday, 9 September 2010 01:25:28 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:31 GMT