【问题标题】:pseudo-elements disappear in ie10 in combination with flexbox [duplicate]伪元素在 ie10 中与 flexbox 结合消失 [重复]
【发布时间】:2018-01-24 11:08:50
【问题描述】:

我的 IE10 和 flexbox 有问题。目前我使用如下sn-p之类的代码。

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>

【问题讨论】:

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


【解决方案1】:

您需要为.container 添加此样式才能在 IE10 中工作:

display: -ms-flexbox;
-ms-flex-wrap: wrap;

【讨论】:

    猜你喜欢
    • 2021-09-10
    • 2012-12-16
    • 1970-01-01
    • 2017-01-22
    • 2013-05-24
    • 1970-01-01
    • 2016-05-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多