在Safari / Chrome中覆盖图像上的CSS最小宽度

克里斯

我正在将最小宽度样式从100%覆盖为自动,这在Firefox中效果很好,但在Safari和Chrome中却不能。我不知道为什么..?!

在下面或http://jsfiddle.net/zxsbodLp/中找到我的示例代码

div img {
    min-width: 100%;
    max-width: 100%;
    width: auto !important;
    height: auto !important;
}

div.small img {
    min-width: auto;
    max-width: auto;
}
<div>
    <img src="http://lorempixel.com/400/200/" width="400" height="200" alt="" />
</div>
<div class="small">
    <img src="http://lorempixel.com/400/200/" width="400" height="200" alt="" />
</div>

用户名

以下应该工作。

min-width: initial!important;

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章