I just did something stupid with my CSS but it had me scratching my head for a while.
If you have a max-width set and need to disable it in a cascaded style, you need to set it to none rather than auto i.e.:
img { max-width:100%; } #some-other-selector img { max-width:none; }
This sounds obvious (and it is really), but because you usually use width:auto to override a previously specified width, I found myself inadvertantly doing the same with max-width and it took a while to realise what I’d done.
8 Comments
Better
max-width : inherit !important;
Why is this better?
Thanks for posting this as it had me scratching my head for a while too! Obvious, but sometimes the obvious just isn’t so obvious! 🙂
inherit !important;
works for me, while
max-width:none;
does not.
max-width:none;works great thank yu ..sir
Thanks for this solution.
If you’re using a fieldset be aware that fieldset has a min-width set too. This can seriously get confusing, especially if you end up with max-width: auto or some other invalid value. For max-width ‘auto’ is identical to max-width: XXXXX. See this for fieldsets: https://stackoverflow.com/questions/17408815/fieldset-resizes-wrong-appears-to-have-unremovable-min-width-min-content
Works for me thanks
8 Trackbacks
schwartz joe meditubs
Disabling a previously specified max-width
http://www.promotionvoucher.co.uk/
Disabling a previously specified max-width
http://www.visitenglandsnorthwest.com
Disabling a previously specified max-width
ilciuc.com
Disabling a previously specified max-width
visit the following website
Disabling a previously specified max-width
Content filters free for photoshop cs5
Disabling a previously specified max-width
bhojpuri chhath puja songs pawan singh video
Disabling a previously specified max-width
million mile cars
Disabling a previously specified max-width