Re: [selectors] :nth-child(An+B of selector) with a pseudo element

Benjamin Poulain skrev:
> Hi,
>
> Currently, :nth-child() does not restrict pseudo-elements like :not() does. Shouldn’t it have the same restrictions?
>
> For example:
>     :nth-child(2n of ::after)
>     :nth-child(2n+1 of ::first-letter)
> do not make much sense.
>
> Benjamin
>
>
I don't see how this is nonsense. Very unlikely and probably tricky to
setup, yes, but not nonsense.

I do not see why a pseudoelement can't contain a real element. There are
two kinds of pseudo elements as far as I know: grouping ones and
generating ones. Both should be able to have real elements as children.

This html snippet exemplifies one such scenario.

<p>A cat <img src="cat.jpg"> with a tail <img src="tail.jpg"></p>

The images would be clear child elements of a ::first-line pseudo
element, assuming that the line hasn't been broken during the layout.

Similarly, I do not see why a content generating pseudoelement can't
introduce an entire subtree. In fact, the option to specify an URI for
the "content" property seems to imply that might already be possible by
simply specifying an URI pointing to a resource with a document tree of
its own. I have not tried this.

Please clarify if pseudo elements are forbidden from containing child
elements.

Received on Wednesday, 17 September 2014 18:00:56 UTC