宽度属性'max-content‘和'fit-content’的值不适用于Edge和Internet。
.div{
border: 1px solid;
margin-left: auto;
margin-right: auto;
width: max-content;
width: -moz-max-content; //works fine on Mozilla
width: -ms-max-content; //doesn't work on EDGE and MS-Explorer
}
发布于 2018-12-10 09:17:15
您可以从注释中的链接中看到,IE和Edge都不支持max内容和fit内容。
我建议,也许有一个解决办法,使用显示:内联块。由于不知道你的网页是如何设计的,我只是做了一个测试在我的一边。希望这会有帮助。
CSS。
<style>
.box {
background-color: #f0f3f9;
padding: 10px;
margin: 10px auto 20px;
overflow: hidden;
}
.inline-block {
display: inline-block;
}
</style>
HTML
<strong>display:inline-block;</strong>
<div class="box inline-block">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/200x200.jpg">
<p>What a lovely pattern we got there in this image which is encapsulted in a figure.</p>
</div>
此外,您还可以参考以下链接:CSS3 -ms-max-content in IE11
https://stackoverflow.com/questions/53690687
复制相似问题