Width属性“max-content”和“fit-content”的值不适用于Edge和Internet Explorer .
.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
}
1 回答
您可以从评论中的链接看到IE和Edge都不支持max-content和fit-content .
我建议可能有使用display的变通方法:inline-block . 由于不知道您的页面是如何设计的,我只是在我身边进行测试 . 希望这会有所帮助 .
CSS .
HTML .
此外,您还可以参考此链接:CSS3 -ms-max-content in IE11