As of Firefox 121, I intend to implement the `hanging` and `each-line`
keywords for the `text-indent` CSS property.
This is an extension of the existing `text-indent` property, and seems
pretty low risk, so I propose to immediately enable it by default,
although with a pref so that the new keywords could easily be disabled
in case of any unexpected issues.
Summary:
The `text-indent` property is used to specify indentation of the first
line of a block (paragraph). The optional `hanging` and `each-line`
keywords let authors modify this behavior to produce "hanging
indentation" (where all lines *except* the first are indented), and/or
to apply the indent after forced breaks (<br>) as well as to the first
line of the block.
A `hanging` result can be obtained using margin or padding combined with
a negative `text-indent` length, but this is less obvious/convenient for
authors, and may conflict with other uses of padding or margins on the
block. To simulate `each-line`, authors would typically need to wrap
each line in additional markup.
Cases where such layout is commonly used include bibliographies and poetry.
For examples, see 29 & 30 in the linked spec.
Bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=784648
Specification:
https://drafts.csswg.org/css-text-3/#text-indent
Standards Body:
W3C CSS Working Group
Platform coverage:
all
Preference:
layout.css.text-indent-keywords.enabled
DevTools bug:
n/a
Link to standards-positions discussion:
None, this has been in the spec for some time[1]
Other browsers:
Blink: not currently implemented
WebKit: shipping since Safari 15
web-platform-tests:
/css/css-text/animations/text-indent-*
/css/css-text/parsing/text-indent-*
/css/css-text/text-indent/text-indent-each-line-hanging.html
[1] FTR, `each-line` originates 13 years ago in
https://github.com/w3c/csswg-drafts/commit/6bf84c50b6fb2d09f5dadb609bf9009d1775db4c.
The `hanging` keyword was present at least several years prior to that.