6 ms·
> To which I reply, do i really have to include ~500K - 1MB of some framework for this!?! What framework? .center-the-stuff { display: flex; a
by namuol 10y ago
> To which I reply, do i really have to include ~500K - 1MB of some framework for this!?!
What framework?
.center-the-stuff {
display: flex;
align-items: center;
justify-content: center;
}
- deleted 10y ago[deleted]
- fiveseven_ 10y agohere's a non-flexbox solution, but the parent element has to have a set height: .parent { position: relative; } .child { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
- alkonaut 10y agoIt's like a magic spell that makes very little sense and is impossible to guess. If I fire up a reasonable layout system (Xaml for example) which is completely foreign, it's trivial to do there. I can't understand why html/CSS makes it so hard.
- lj3 10y agoBecause html/css was never intended to be used for layout. It's primarily a content styling system for static documents.