Re: Nested :first-letter

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 UTC