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.
How to Center in CSS (2015)
31–40 of 74 posts
Re: How to Center in CSS (2015)
#32This is a straw man. Today you can simply use flexbox on the container: display: flex; justify-content: center; // horizontal align-items: center; // vertical Doesn't work in IE without a JS polyfill (which is available), but has worked in all other browsers for six years or so.
Re: How to Center in CSS (2015)
#33However, there are still couple of common tasks that are pain/hard/impossible to do with just CSS.
Recently I learned that after all this years you still need to use JS to get css animation for dynamic height ("height:auto") of elements.
And there is no progress in fixing it at CSS standard level. It's just sad... https://github.com/w3c/csswg-drafts/issues/626 https://stackoverflow.com/questions/3508605/how-can-i-transi... https://stackoverflow.com/questions/3508605/how-can-i-transi...
Re: How to Center in CSS (2015)
#34This is a straw man. Today you can simply use flexbox on the container: display: flex; justify-content: center; // horizontal align-items: center; // vertical Doesn't work in IE without a JS polyfill (which is available), but has worked in all other browsers for six years or so.
And yet six years later still no widespread support for the 'safe' keyword. Which means the content can overflow the container without a way to scroll to some parts of it: https://jsfiddle.net/r50qseah/
Re: How to Center in CSS (2015)
#35It 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.
I wouldn’t recommend using it for big or professional projects, but I guess it’s fine for personal stuff. Like the other comment said it’s an obsolete tag. Browsers tend try hard not to break old HTML but not sure that’s guaranteed to always be the case.
Re: How to Center in CSS (2015)
#36Centering in CSS is "solved" problem if your "worst" browser to support is IE11. Flexbox does the job there. However, there are still couple of common tasks that are pain/hard/impossible to do with just CSS. Recently I learned that after all this years you still need to use JS to get css animation for dynamic height ("height:auto") of elements. And there is no progress in fixing it at CSS standard level. It's just sa…
Edit: Oh, I just saw that the stackoverflow question you linked has this for the accepted answer :)
Re: How to Center in CSS (2015)
#37Earlier quoted context omitted.
And yet six years later still no widespread support for the 'safe' keyword. Which means the content can overflow the container without a way to scroll to some parts of it: https://jsfiddle.net/r50qseah/
What is the 'safe' keyword?
Re: How to Center in CSS (2015)
#38Re: How to Center in CSS (2015)
#39Earlier quoted context omitted.
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...
You’re right of cause and centering is styling and it doesn’t belong in the html. It just that sometimes I really can’t be bothered with css and the center hr and a ton of br slips in, and it works well enough.
Re: How to Center in CSS (2015)
#40It 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.
I've been doing HTML for ~10 years and have never seen this before. Apparently, it was deprecated with HTML4 already, though I'm not sure why.