13
Dacexi
7y

CSS Vertical Alignment:

div {
display:flex;
align-items:center;
}

This is not a problem anymore, so can we stop pretending like it is?

Comments
  • 1
    @thmnmlst always worked for me
  • 2
    I'd say it's still a problem for some due to its poor support on older browsers. Some of us here are still required to support <IE9 (and yes, it sucks).
  • 1
    And did you know about
    position: absolute
    top: 50%
    left: 50%
    transform: translateX(-50%) translateY(-50%)
    ?

    It was never a problem - theoretically. But shit always fucks up when stuff gets a bit bigger.

    EDIT: and old browsers suck ofc.
  • 0
    For the flexbox to work properly, the container need be full height as well, otherwise the children are vertically centered, but not over the full height of the page.
  • 1
    Look, I've built a rocket during the time it took you to center that vertically ;)
Add Comment