繁体   English   中英

css min-width和max-width?

[英]css min-width and max-width?

.post-body p img {
    min-width:100%;
    margin-bottom:15px;
}
.post-body p img.thumb-small {
    min-width:auto !important;
    max-width:100%;
    margin-bottom:15px;
}

我希望我体内p后面的所有图像都是最小宽度100%。 但是,如果图像有一个拇指小的类,那么应该没有最小宽度? 如何用这个类反转图像的行为?

谢谢

如何用这个类反转图像的行为?

.post-body p img.thumb-small {
    min-width:0;
    }

您可以为缩略图指定min-width为零:

.post-body p img.thumb-small {
    min-width: 0;
    max-width: 100%;
    margin-bottom: 15px;
}

你不需要!important 样式规则更具体,因此无论如何都会优先。

没检查过,但是

min-width: 0;

应该工作,不需要!重要的是,你已经用添加的类重写了规则。

min-width: inherit

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM