I am searching for the following solution. In my CSS I have the following:
img, a img {
max-width: 100%;
vertical-align: middle;
}
This code is necessary for my WordPress theme and responsive web design. Now I want to override max-width
property to auto
. When I do this, it doesn't override:
#pixel-perfect img {
max-width: auto !important;
position: absolute;
margin: -200px 0 0 -140px;
z-index: -9999;
}
What did I do wrong?
The max-width property in CSS is used to set the maximum width of a specified element. The max-width property overrides the width property, but min-width will always override max-width whether followed before or after width in your declaration.
max-width overrides width , but min-width overrides max-width .
You can simply use the CSS display property with the value inline-block to make a <div> not larger than its contents (i.e. only expand to as wide as its contents).
Are you just looking to unset the max-width
property? If so, try:
#pixel-perfect img {
max-width: none;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With