简体   繁体   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;
}

i want all my images inside of post-body p to be min-width 100%. 我希望我体内p后面的所有图像都是最小宽度100%。 However if the image has a class of thumb-small there should be NO min-width? 但是,如果图像有一个拇指小的类,那么应该没有最小宽度? how can i reverse that behaviour for images with this class? 如何用这个类反转图像的行为?

thank you 谢谢

how can i reverse that behaviour for images with this class? 如何用这个类反转图像的行为?

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

You could just specify a min-width of zero for the thumbnails: 您可以为缩略图指定min-width为零:

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

You don't need the !important . 你不需要!important The style rule is more specific, so it will take precedence anyway. 样式规则更具体,因此无论如何都会优先。

Haven't checked it, but 没检查过,但是

min-width: 0;

should work, no need for !important, you are already overriding the rule with the added class. 应该工作,不需要!重要的是,你已经用添加的类重写了规则。

min-width: inherit

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

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