诚然,这是一个老问题,但是,它仍然显示在搜索,以便想一个答案更新:
目前在Chrome 23和Firefox每晚21.0a1此布局的工作,以保持图像的大小父div和调整大小(并保持居中)。
http://jsfiddle.net/qAErr/
HTML
<section id="holdMe">
<div>
<img src="http://www.w3.org/html/logo/downloads/HTML5_Logo_512.png" alt="html5"/>
</div>
</section>
CSS
#holdMe {
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: -o-flex;
display: flex;
-webkit-justify-content: center;
-moz-justify-content: center;
-ms-justify-content: center;
-o-justify-content: center;
justify-content: center;
}
#holdMe img {
width: 100%;
}
我删除了浏览器的前缀,当我张贴的问题;我现在已经恢复了他们;仍然没有调整大小。 – 2011-03-28 04:22:16
是的,你说得对。看起来Flexbox模型的行为与块模型不同。它似乎更像是标准表格布局,每个框中的元素可以伸展父级。尝试调整窗口大小:http://jsfiddle.net/kmiyashiro/RFqPM/3/ – kmiyashiro 2011-03-28 20:07:07
是的。关于如何让儿童图像在显示框中调整到100%的任何想法? – 2011-03-29 03:59:26