css - ie10结合flexbox伪元素消失

标签 css internet-explorer flexbox internet-explorer-10 pseudo-element

<分区>

我对 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/

上一篇:wordpress - List 元素的动态高度带来总混沌

下一篇:javascript - 选择主动滑动

相关文章:

css - 如何正确使用表的表环境

html - 输入元素在引导网格中具有意外的包装行为

html - Flexbox 内容溢出容器。 Chrome

jquery - MixItUp 和 Masonry 不能一起工作

html - 如何检查JqxGrid是否有错误?

html - 背景图片调整大小改变了android中的 View

internet-explorer - IE 11(更新版本 : 11. 0.24)内存消耗问题

html - 让可折叠导航栏在 Internet Explorer 中工作的问题

css - IE 上的 z-index,无法获取按钮后面的 div 文本

html - Flexbox 对齐 self :flex-start/end is adjusting horizontally not vertically