Re: CSS text-align-last property

On 8/18/21 1:14 AM, Murtaza Abbasi wrote:
> Dear Team,
> This is Ghulam Murtaza, I would like to share my suggestion for the property 
> /text-align-last/. To me, this property is going out of CSS flow, because we 
> already have pseudo-element selectors for example "/::first-line"/ selects the 
> first line. I think we should do the same with the last line of the paragraph 
> i.e. /"::last-line"/. This way, we can do more than just applying aligning to 
> text.

Hi!
There are a couple reasons why we didn't go with this:

* pseudo-elements that cross element boundaries like ::first-line
   are very difficult to implement

* ::last-line in particular is trickier than ::first-line because
    whether the line is last changes during incremental layout

* there weren't any particularly strong use cases for ::last-line
   other than controlling its text alignment

* ::first-line applies to the "first formatted line" in the element;
   ::last-line should presumably be the "last formatted line" in the
   element. But text-align-last needs to apply to every line that
   ends in a forced break, not just the last line in the element.

So for all these reasons, we did not go with the ::last-line approach.

~fantasai

Received on Tuesday, 24 August 2021 21:56:30 UTC