46
Comments
  • 8
    or who still uses this 😀
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  • 5
    Or you could use display: table / table-cell and make it work on ie8 and responsive on ie9 :) .
  • 2
    I even saw a guy using the hidden IE integrated button centering method. Cause buttons in IE center xD
  • 2
    Totally depends on usecase.
  • 5
    Grid is 1 dimension more than flex and it's fucking great
  • 1
    @Mitiko teach me daddy
  • 2
    @BambuSource I sure as hell use it. If it doesn't work, try margin auto. If that doesn't work, display flex. That's how I roll.
  • 1
    Also text-align: center on the parent element, and setting an explicit width on the item to be centered. And display: block if centering an inline by default element like <a>
  • 0
    This is y you use bootstrap and stop wasting time and sanity fighting css
  • 0
    @Mitiko What I don't get: Why does flex still exist if grid is superior?

    Oh right, webdevelopment, deprecations take 4 decades.
  • 0
    @bittersweet grid is still an experimental feature.
  • 1
    @BambuSource Yeah but that's the problem with browsers in my opinion. You can't really have experimental features, because people start using them in production anyway. Flex is wellsupported, Grid is pretty well supported already — difficult to "refactor" all of it afterwards.

    So new webdevs get to learn n+1 ways of doing things.

    Sorry, ranting mood today.
Add Comment