Reputation: 85545
Say, I'm using a plugin, component and there is inline-css applied with !important
. Now how could I override that css.
Here's an example which would obviously not work as div is more specific but with given important in inline makes it more specific.
<div>
<p style="color: red !important;">color is red</p>
</div>
div p{
color: blue !important; /*I wanted to override but this won't work*/
}
Upvotes: 0
Views: 93
Reputation: 144
Its possible Use Jquery for this purpose
$(function () {
$('p')
.attr('style', 'color: blue !important;')
});
demo :- http://jsfiddle.net/jjWJT/25/
Upvotes: 0
Reputation: 1
You can not override inline CSS having !important, because it has higher precedence, but using Javasctip/Jquery tweaks you may achieve what you want. you can use this:DEMO
Upvotes: 0
Reputation: 4588
If you cannot change the HTML due to the use of a plugin, you can only use JS to get rid of it. Thankfully it's quite simple.
$('div p[style]').attr('style', '');
(following your example.) Obviously make it a bit more specific for just the bits in that plugin you want to change.
Upvotes: 4