[csswg-drafts] [css-text] Propose 'text-indent: previous-line' or similar

robinwhittleton has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-text] Propose 'text-indent: previous-line' or similar ==
There’s a use-case for `text-indent` from traditional print layout that is not being met by the current specifications: a line indented to the end of the previous paragraph’s line. For example, [this Keats poem](https://archive.org/stream/completepoetical01keat#page/98/mode/2up):

![The line beginning ‘Thus ended he’ is indented to the level of the end of the last line of the preceding paragraph ‘of weary life.’](https://user-images.githubusercontent.com/7414/31317823-3136476e-ac48-11e7-9ed0-9dba829c525e.png)

or [this poem from Wordsworth](https://archive.org/stream/in.ernet.dli.2015.53574/2015.53574.Lyrical-Ballads#page/n193/mode/2up):

![The line beginning ‘Though absent long’ is indented to the level of the end of the last line of the preceding paragraph ‘the hermit sits alone.’](https://user-images.githubusercontent.com/7414/31317868-e5af0c08-ac48-11e7-9dbb-abf9ae3bc33a.png)

`text-indent: previous-line` could work like this:
1. Find the preceding generated line box in the DOM
2. Measure its width
3. Apply an indent in the natural language direction of the element the rule applies to that matches the width of the previous element.

Obviously as with anything like this there are a bunch of interactions that would need to be discussed:
- _Flexbox reordering:_ this should presumably be ordering-aware.
- _Not applying to first block of a separate section:_ can be reset using typical declarations (e.g. `p:first-child { text-indent: 0; }`) or only applied to following elements (`p + p { text-indent: previous-line; }`).
- _RTL issues:_ boxes that share a direction will both work fine. Boxes with separate directions probably don’t have a use case for this, so a naive solution of simply applying the same indent in the opposite direction feels fine.

As far as I can work out there’s nothing in any of the existing css-text specifications that would allow this. It’s not important enough for inclusion in CSS Text 3, but is it a valid use case for CSS Text 4?

I’ve not tried to suggest an extension to the specs before so I’m not sure this is the best way to go about it; if I should be making a proposal on a mailing list I’ll happily do that instead.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1853 using your GitHub account

Received on Sunday, 8 October 2017 15:09:05 UTC