Doesn't Flexbox pretty much solve this problem? I mean, if you need to maintain backwards compatibility this might be reasonable, but "justify-content: center" and "align-items: center" seem to work unreasonably well for this exact purpose.
Flexbox solves this problem but it's still a bit unwieldy and verbose.
How to Center in CSS
21–30 of 297 posts
Re: How to Center in CSS
#22This site doesn't seem to be suggesting absolute centering [1] when it would be the easiest way to center things. "margin: auto" seems to be the way that the designers of CSS 2.1 intended to center things. 90% of the time, absolute centering is the easiest way to center in CSS; you should prefer it when possible. [1]: http://codepen.io/shshaw/full/gEiDt
Re: How to Center in CSS
#23Wow CSS is unfriendly, you really realise how poor it is once you learn other layout systems (android's XML and iOS auto layout, etc). Wish there was another standard that could co-exist side by side on the web, something simple enough to be implemented reliably by the browser vendors.
Personally, I don't find css to be that bad at all, but I work in it at least a little everyday so it might just be stockholm syndrome.
Re: How to Center in CSS
#24Earlier quoted context omitted.
Flexbox solves this problem but it's still a bit unwieldy and verbose.
Verbose? Compared to the other solutions it's a godsend, just use the CSS-tricks guide for it and you'll have nearly zero problems. I absolutely love it and pretty much refuse to use anything else for layout in CSS now.
Re: How to Center in CSS
#25Doesn't Flexbox pretty much solve this problem? I mean, if you need to maintain backwards compatibility this might be reasonable, but "justify-content: center" and "align-items: center" seem to work unreasonably well for this exact purpose.
Flexbox solves this problem but it's still a bit unwieldy and verbose.
Re: How to Center in CSS
#26By this, I mean generating the following individually: 1) the HTML with a class applied to a sample element to be centered 2) the separate CSS for that particular class selector
This is just a little nitpick based on my preference for avoiding inline styles; overall, nice work!
Re: How to Center in CSS
#27Browser support: http://caniuse.com/#feat=flexbox
Re: How to Center in CSS
#28Earlier quoted context omitted.
Flexbox solves this problem but it's still a bit unwieldy and verbose.
Verbose? Compared to the other solutions it's a godsend, just use the CSS-tricks guide for it and you'll have nearly zero problems. I absolutely love it and pretty much refuse to use anything else for layout in CSS now.
Re: How to Center in CSS
#29Earlier quoted context omitted.
Flexbox solves this problem but it's still a bit unwieldy and verbose.
Verbose? Compared to the other solutions it's a godsend, just use the CSS-tricks guide for it and you'll have nearly zero problems. I absolutely love it and pretty much refuse to use anything else for layout in CSS now.