9.5 · Layout
Center absolute elements: place-self
Align absolutely positioned elements with place-self instead of transforms.
Centering an absolutely positioned element used to mean
top: 50%; left: 50%; transform: translate(-50%, -50%).
That fights with any other transform and is hard to read.
Alignment properties now work on absolutely positioned elements. Give
it inset: 0 so its area covers the parent, then
place-self: center, or start end for a
corner badge.
.play {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.play {
position: absolute;
inset: 0;
place-self: center;
}