News for hackers. Stuff that matters.
Re:New CSS Features in Firefox 68 by Aardwolf on Wednesday July 31, 2019 @03:24PM (#20577360)
How about a simple, single, CSS property that can simply say:

"horizontally center this text inside its rectangular element"

And another one for:

"vertically center this text inside its rectangular element"

The issue of centering wrapped multiline text has been solved in many UI libraries.

Re:New CSS Features in Firefox 68 by joekrill on Wednesday July 31, 2019 @05:04PM (#20578522)
Well there is one for the first: `text-align: center;`.

But things can quickly get very complicated. This all needs to be done in the context of a ton of other CSS rules that could alter layout. And by the way, what do you mean by "vertically centered"? Using the font's baseline? Text top? Bottom? How are we dealing with text overflow if there isn't enough room in your rectangular element?

Re:New CSS Features in Firefox 68 by butz on Wednesday July 31, 2019 @03:31PM (#20577456)
display: flex; justify-content: center; align-items: center;
Re:New CSS Features in Firefox 68 by silverwind on Wednesday July 31, 2019 @04:48PM (#20578386)
Those will clip child content when they overflow. There is a fix, but only supported by Firefox currently:

justify-content: safe center; align-items: safe center;

Re:New CSS Features in Firefox 68 by Izkata on Wednesday July 31, 2019 @06:55PM (#20579458)
I mean, if we're going for multiple attributes anyway, this has worked since long before flexbox:

On the parent:

  position: relative;
On the element to be centered:

  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);