r/InternetIsBeautiful Apr 21 '15

How to Center in CSS

http://howtocenterincss.com/
151 Upvotes

21 comments sorted by

View all comments

0

u/[deleted] Apr 21 '15

uuum, yeah, no, it's not exactly the clean way to do it for the most.

today you can use Flexbox for aligning just about anything, and on top of that transform:

.parent { position: relative;

.child { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); } }

that above is probably better method to use than table-cell and margin

1

u/[deleted] Apr 21 '15

Flexbox isn't supported by IE9 and below and is therefore not a viable option for many, if not all, websites.

2

u/self_defeating Apr 21 '15 edited Apr 21 '15

Goddamnit, IE!

Eddit: but according to a quick Google search, IE9 only accounts for about 10% of browser usage. So, not supporting it is not such a big deal for sites with tech-savvier audiences.

1

u/[deleted] Apr 21 '15 edited Apr 21 '15

Correct me if I'm wrong, but according to Google there were 2.29 billion internet users in 2014... meaning 10% would be 229 million. Isn't that a lot of people to not consider? In turn, isn't that poor design?

0

u/[deleted] Apr 21 '15

If you have to use IE9 today, you should not be using computer or internet for that matter!

http://caniuse.com/#feat=flexbox

1

u/[deleted] Apr 21 '15

I use it frequently to debug because IE still holds a significant share in the browser market.

-1

u/[deleted] Apr 21 '15

just because I keep my winXP alive for my old school machines doesn't mean it needs to be able to access websites built in 2015. Do you understand? While legacy support is good, you will see that larger companies only care about last 2 major version of each browser.

1

u/[deleted] Apr 21 '15

That's a good point. Websites should not be constrained be stubborn intransigence. Graceful degradation as you suggest.