Skip to content

[css-pseudo] Multi-line ::first-letter #2254

Open
@Loirooriol

Description

CSS Pseudo says

The ::first-letter pseudo-element represents the first typographic letter unit on the first formatted line of its originating element [...]
Punctuation (i.e, characters that belong to the Punctuation (P*) Unicode general category) that precedes or follows the first typographic letter unit must also be included in the ::first-letter pseudo-element.

Then, consider this case:

<p>‘T</p>
p {
  width: 0;
  word-wrap: break-word;
}
p::first-letter {
  background: lime;
}

The first line only has , which is punctuation but not a typographic letter unit.

The second line has T, which is a typographic letter unit, but it's not on the first formatted line.

So, according to the spec, I would expect no ::first-letter pseudo-element. But it seems to exist in all major browsers, despite no interoperability: https://jsfiddle.net/gv9snq9g/

screenshot2

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions