2 ms·
No it doesn’t: http://www.w3.org/TR/css3-flexbox/ http://www.w3.org/TR/css3-flexbox/. To whit: <div id="container"> <div id="centered"></div> </div>
by robin_reala 14y ago
No it doesn’t: http://www.w3.org/TR/css3-flexbox/ http://www.w3.org/TR/css3-flexbox/. To whit:
<div id="container">
<div id="centered"></div>
</div>
#container {
display: flex;
width: 1000px;
height: 1000px;
background: gray;
}
#centered {
margin: auto;
width: 500px;
height: 500px;
background: red;
}
Of course, we’re waiting on implementations to catch up with the spec: http://caniuse.com/#feat=flexbox http://caniuse.com/#feat=flexbox . That’s not really the W3’s fault though.
- morsch 14y agoDoes that also work when you don't know the width and height of container and centered in advance?
- MDCore 14y agoThat "spec" was a Working Draft in June 2012 and a Candidate Recommendation in September 2012. It's still not final. And browser vendors have implemented prefixed versions (even Microsoft!). I think it is reasonable to criticise the W3 for not finalising something we've been struggling with for over fifteen years.