How to override max-width for specific div?

前端 未结 5 2100
后悔当初
后悔当初 2020-12-18 21:58

I am searching for the following solution. In my CSS I have the following:

img, a img { 
    max-width: 100%;
    vertical-align: middle; 
}
<
5条回答
  •  遥遥无期
    2020-12-18 22:42

    I think it's because a img is more specific than #pixel-perfect img. Element selector is more specific than id selector (So in this example you have 2 elements vs 1element and 1 id).

    In order to fix it, you'd have to add an element to your declaration, for example:

    a#pixel-perfect img {
        max-width: auto !important;
    }
    

提交回复
热议问题