<分区>
<分区>
我对 IE10 和 flexbox 有疑问。目前我使用如下代码片段。
col 2 的内容有一个可变长度(有多个小元素),它应该有它需要的宽度。我想在它们之间划一条线。为此我加了一个伪元素,通过order
把它放在正确的位置,宽度为100%。
Chrome、Firefox 等可以渲染这个例子,但是如果我用 IE10 运行它,伪元素消失,第二行的内容自动移动到第一行。
难道IE10不能和flexbox一起渲染伪元素吗?您知道强制中断的“技巧”吗?
/* Container */
.container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
width: 200px;
}
.container:after {
background-color: #000;
content: '';
height: 2px;
margin: 5px 0;
order: 3;
width: 100%;
}
/* Child */
.child {
width: 100px;
border: 1px solid red;
box-sizing: border-box;
height: 50px;
line-height: 50px;
text-align: center;
}
/* Positioning of the childs */
.c1 {
order: 1
}
.c2 {
order: 2
}
.c3 {
order: 4
}
.c4 {
order: 5
}
<div class="container">
<div class="child c1">row 1 col 1</div>
<div class="child c2">row 1 col 2</div>
<div class="child c3">row 2 col 1</div>
<div class="child c4">row 2 col 2</div>
</div>
最佳答案
您需要为 .container
添加此样式才能在 IE10 中工作:
display: -ms-flexbox;
-ms-flex-wrap: wrap;
关于css - ie10结合flexbox伪元素消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45711318/