JSFiddle Link
.thing {
background-color: tomato;
max-width: 300px;
padding: 30px;
display: flex;
margin: 0 auto;
flex-flow: column wrap;
}
.not-centered {
max-width: 150px;
background-color: #fefefe;
margin: 0 auto;
}
<div class="thing">
<div class="not-centered">
im not centeredi in ie11
</div>
</div>
我认为它可以工作,因为如果设置了 max-width
和 margin: 0 auto
。但是正如你所看到的,它不是水平居中的,因为他的父 .thing
有 flex-flow: column wrap
。
有什么想法可以在此设置中解决这个问题吗?
P.S. 适用于 Chrome/FF
最佳答案
将 .not-centered
包装在 div
中并显示 block
解决了 IE11 中的问题
关于css - 当父项具有 flex-flow : column wrap; 时,元素在带有 Flexbox 的 IE11 中未水平居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31354137/