Seems IE11 doesn't calculate flex item widths properly if flex-wrap: wrap
is used.
See http://jsfiddle.net/MartijnR/WRn9r/6/
The 4 boxes each have flex-basis: 50% so we should get two lines of two boxes each, but in IE11 each box gets one line. When setting the border to 0, it works correctly.
Any idea if this is a bug, or if there is way to make IE11 behave (and still use borders)?
<section>
<div class="box">1</div>
<div class="box">2</div>
<div class="box">3</div>
<div class="box">4</div>
</section>
section {
display: -moz-flex;
display: -webkit-flex;
display: flex;
-moz-flex-direction: row;
-webkit-flex-direction: row;
flex-direction: row;
-moz-flex-wrap: wrap;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
width: 100%;
box-sizing:border-box;
margin:0;
}
.box {
border: 1px solid black;
background: #ccc;
display: block;
-ms-flex: 50%;
-moz-flex: 50%;
-webkit-flex: 50%;
flex: 50%;
box-sizing: border-box;
margin:0;
}
P.S. In my project only the last version of popular browsers needs to be supported, thankfully, but IE11 is one of them.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…