作者:fvcvb_974 | 来源:互联网 | 2023-08-19 19:30
SeemsIE11doesntcalculateflexitemwidthsproperlyifflex-wrap:wrapisused.看起来IE11没有正确地计算fle
Seems IE11 doesn't calculate flex item widths properly if flex-wrap: wrap
is used.
看起来IE11没有正确地计算flex条目宽度,如果使用了flex-wrap: wrap使用。
See http://jsfiddle.net/MartijnR/WRn9r/6/
参见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.
这4个盒子都有弹性基:50%所以我们应该得到两行两个盒子,但是在IE11中每个盒子都有一行。当将边界设置为0时,它可以正常工作。
Any idea if this is a bug, or if there is way to make IE11 behave (and still use borders)?
你知道这是一个bug吗?或者有办法让IE11正常运行吗?
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.
附注:在我的项目中,只需要支持流行浏览器的最后一个版本,谢天谢地,IE11就是其中之一。
4 个解决方案