Live data from Hacker News

How to Center in CSS (2015)

howtocenterincss.com

21–30 of 74 posts

Re: How to Center in CSS (2015)

#21

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) ?

Flexbox did fix it, and it's been available in Chrome since 2013, Firefox since 2014, and everything else since 2015. IE 11 supported enough of the 2012 syntax to be usable. Even IE 10 supports some of it, albeit poorly.

Re: How to Center in CSS (2015)

#22
post #9

Earlier 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.

Well it's not true if you decide to ignore the fact that this does address the situations in which centering is a pain in the ass. If you exclude all the factors this takes into account, it obviously becomes trivial.

Re: How to Center in CSS (2015)

#24
post #9

Earlier 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.

That's only misleading if you don't have to support IE. I'm guessing that's the case for you but many of us still have to.

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)

#25
It 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.

Re: How to Center in CSS (2015)

#27

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) ?

I just throw a in, it works well enough for most cases.

I prefer for maximum centeredness

Re: How to Center in CSS (2015)

#29

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) ?

I just throw a in, it works well enough for most cases.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ce...

The element is obsolete and is not in the HTML5 spec...

Re: How to Center in CSS (2015)

#30
post #25

It 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.

It's avoided because it's obsolete and is not in the HTML5 spec: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ce...
Post reply on HN