Posted in css

back to articles

Follow Me on Twitter

CSS fix: Overriding inline styles

The Problem


<div class="info" style="width:350px;></div>

That nasty inline style is causing all kinds of trouble, here’s how to fix it.

The solution


div.info[style]{width:300px!important;}

Voila! things to note here are the [style] and !important, it allows you to target and override any inline styles.

Thanks for reading,

Matthew

* I have rid this site of comments. To be honest I never got enough to satisfy my bloated ego.
Write me on twitter, i'm always there. No captchas I promise.