Re: [csswg-drafts] [css-pseudo-5] ::text / ::text-node pseudoelement (#2208)

We have to keep in mind, though, that `:nth-child()` and similar functions then work differently when applied to `::text` versus being applied to real elements. In the `::text` case, all text _and_ element nodes are counted, in the second case only elements.

Example:
```html
<span>Some <em>simple</em> example for <code>::text</code>.</span>
```

```css
/* Makes " example for " green */
span::text:nth-child(3) {
  color: green;
}

/* Makes the <code> element green */
span > :nth-child(2) {
  color: green;
}
```

Sebastian

-- 
GitHub Notification of comment by SebastianZ
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2208#issuecomment-4255429742 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 15 April 2026 20:59:09 UTC