I am not into the CSS game anymore, if anything needs to be done I'd just go with whatever widgets any CSS framework offers, but why has it been so hard for so long to center things with CSS (I believe flexbox finally fixed it) ?
How to Center in CSS (2015)
21–30 of 74 posts
Re: How to Center in CSS (2015)
#22Earlier quoted context omitted.
That is exactly the code the website will generate if you select no IE support.
Yet it opens with this misleading blurb: > Centering in CSS is a pain in the ass. There seems to be a gazillion ways to do it, depending on a variety of factors. Which is no longer true in the great majority of cases.
Re: How to Center in CSS (2015)
#23Here's what I've been doing for years (The can be any element, like ): WFM YMMV
Re: How to Center in CSS (2015)
#24Earlier quoted context omitted.
That is exactly the code the website will generate if you select no IE support.
Yet it opens with this misleading blurb: > Centering in CSS is a pain in the ass. There seems to be a gazillion ways to do it, depending on a variety of factors. Which is no longer true in the great majority of cases.
Also, this site seems to have gone up in 2015 and hasn't changed (substantially) since.
I also don't think you're correct in calling this a straw man. This is not a debate and there was no other party whose assertion this site seems to refute, so calling it a straw man doesn't seem to fit.
Re: How to Center in CSS (2015)
#25Re: How to Center in CSS (2015)
#26Having to still support IE 11 for most projects, I really like the following: div { position: absolute; right: 50%; bottom: 50% transform: translate(50%, 50%); }
Re: How to Center in CSS (2015)
#27I am not into the CSS game anymore, if anything needs to be done I'd just go with whatever widgets any CSS framework offers, but why has it been so hard for so long to center things with CSS (I believe flexbox finally fixed it) ?
I just throw a in, it works well enough for most cases.
Re: How to Center in CSS (2015)
#28Having to still support IE 11 for most projects, I really like the following: div { position: absolute; right: 50%; bottom: 50% transform: translate(50%, 50%); }
Re: How to Center in CSS (2015)
#29I am not into the CSS game anymore, if anything needs to be done I'd just go with whatever widgets any CSS framework offers, but why has it been so hard for so long to center things with CSS (I believe flexbox finally fixed it) ?
I just throw a in, it works well enough for most cases.
The element is obsolete and is not in the HTML5 spec...
Re: How to Center in CSS (2015)
#30It doesn't solve vertical centering, but I am secretly still a fan of the center-tag. Just does what it's name implies in most situations. I still don't get why its avoided like the plague.