chris chris - 5 months ago 24
CSS Question

Overwrite CSS min-width on image in Safari/Chrome

I am overwriting the min-width style from 100% to auto which works fine in Firefox but not in Safari and Chrome. I can't figure out why..?!

Find my samle code below or 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>




Answer

The following should work.

min-width: initial!important;
Comments