0

I've a problem with the IE10 and flexbox. At the moment I use code like the snippet below.

The content of col 2 has got a variable length (with multiple small elements) and it should take the width it needs. I want to have to rows with a line between them. Therefor I added an pseudo-element, put it on the correct position via order with a width of 100%.

Chrome, Firefox, etc. can render this example, but if I run it with IE10, the pseudo-element disappears and the content of the second row moves itself to the first row.

Isn't the IE10 able to render pseudo-elements together with flexbox? Do you know a 'hack' to force this break?

/* 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>
Mel
  • 5,837
  • 10
  • 37
  • 42
tarantel
  • 64
  • 4
  • 1
    IE10 requires different syntax. Have a look here https://stackoverflow.com/questions/18711282/ie10-and-flexboxes-nightmare – Gerard Aug 16 '17 at 10:50

1 Answers1

0

You need to add this styles for .container to work in IE10:

display: -ms-flexbox;
-ms-flex-wrap: wrap;
Farzin Kanzi
  • 3,380
  • 2
  • 21
  • 23