【发布时间】:2019-01-05 09:57:46
【问题描述】:
如果您使用 Internet Explorer 11 查看this page,您会看到图像纵横比不正确 - 图像被垂直拉伸。 IE 11 顽固地显示图像的原始高度。所有其他浏览器(最新的 Chrome、Firefox 和 Edge 版本)显示正确。为什么这个 css 代码不适用于 IE 11?
html:
<section class="content-6 sec-content">
<div class="container sec-right">
<div>
<img src="https://eoy.ee/oosorr/images/8.jpg" alt="Nõmmemännik" width="1280" height="853" />
</div>
</div>
</section>
css:
img {
width:100%;
height:auto;
max-width: 100%;
}
.sec-content{
display:-ms-flexbox;
display: flex;
-ms-flex-direction: column;
flex-direction:column;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-ms-flex-pack: end;
justify-content: flex-end;
}
.sec-content > div{
padding-bottom:50px;
display:-ms-flexbox;
display: flex;
-ms-flex-direction: row;
flex-direction:row;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}
.sec-right{
-ms-flex-pack: end;
justify-content: flex-end;
}
.sec-right > div{
display:-ms-flexbox;
display: flex;
-ms-flex-direction: column;
flex-direction:column;
padding:35px 45px;
position: relative;
z-index: 10;
width: 90%;
}
.sec-right > div::before {
background: rgba(0,0,0,0.4);
content:" ";
top:0;
bottom:0;
width:3000px;
position: absolute;
z-index: -100;
}
.sec-right > div::before {
left: 0;
}
【问题讨论】:
-
IE 在图像是弹性项目方面存在一些问题,您可能会更好地包装图像。如果没有,一种选择是在图像上设置
min-height: 1px,但不能说这是否一直有效。
标签: css internet-explorer flexbox