Re: [csswg-drafts] [css-sizing][css-align][css-text] Aligning an aligned block of text within its container

So how about this: `text-group-align: <'text-align'>`. Non-inheriting, put it on a block at some point in your hierarchy where you want to apply the group-alignment.  This causes the text descendants of the box (down to the next BFC, I imagine) to align as specified in `text-group-align`, *then* the length of the largest such line is used to clamp the width of all the lineboxes (down to the next BFC), and they then align as normal per 'text-align'.

So in the first example PDF, you'd specify `text-group-align: center; text-align: left;` to get the effect.

This is non-inheriting so you can declare it on a particular block that you want all the text inside of to align.

This might also solve some CJK justification issues. It's common to want the longest line to fill the container exactly, and everything smaller to justify inside of that. Right now you can only achieve that if the box width is *exactly* a multiple of 1ic; if it's not, the text will justify looser than you want.  With this, you can do `text-group-align: center; text-align: justify` and get the effect you want - if the box isn't exactly the right size, the extra space will just be used on either side, rather than being distributed between the characters. 

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

Received on Wednesday, 4 April 2018 22:30:55 UTC