2 ms·
display: flex; justify-content: center; align-items: center;
by butz 7y ago
display: flex;
justify-content: center;
align-items: center;
- silverwind 7y agoThose 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;
- Izkata 7y agoI 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%);