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:12:37 -0700
Message-ID: <AANLkTikd=Se=e1d7uTdn+z+nug87NdYZOpf2syzJ5EXN@mail.gmail.com>
To: Simon Fraser <smfr@me.com>
Cc: "www-style@w3.org list" <www-style@w3.org>
On Wed, Sep 8, 2010 at 5:36 PM, Simon Fraser <smfr@me.com> 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?
>
> I don't see anything at <http://www.w3.org/TR/CSS2/selector.html#first-letter> that suggests one rendering over another.

>From the spec:

# The :first-letter pseudo-element can be used with
# all such elements that contain text, or that have
# a descendant in the same flow that contains text.
# A UA should act as if the fictional start tag of
# the first-letter pseudo-element is just before the
# first text of the element, even if that first text
# is in a descendant.

It then gives an example of precisely the situation you provide, where
a <div><p> is nested, and both have a ::first-letter pseudo specified.

Are you asking if inheritance works on ::first-letter pseudos?  The
answer should be yes - pseudoelements mutate the element-tree, not the
box-tree, and so they participate in inheritance.

~TJ
Received on Thursday, 9 September 2010 01:13:50 GMT

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