Possible Duplicate:
best way to overide plugin CSS?

Now and again I would come across a great wordpress plugin with it's own css style sheet. I could edit the css in the plugin folder and it would work like a charm but if there was ever an update for the plugin, it would overwrite my custom css that I applied to it.

I know that I can target the class of the plugin in my own css and applying !important; to the end of the css style. I've read though that this isn't good practice.

Is adding !important to the end of a css style bad practice and if so, what is the best way of targeting custom css of a wordpress plugin?

Thanks Tyler


You can either do it the way you are doing it now, or you can use the rule of greater specificity (ex div.foo > ul#bar > li.baz is more specific than just #bar > .baz).

P.S. I am not sure this is WordPress-specific.

  • The CSS part of the question itself certainly isn't WordPress-specific; however, the question of how to override Plugin-defined CSS rules is WordPress-specific. It seems, though, that this question has already been asked elsewhere on WPSE. – Chip Bennett Feb 15 '12 at 14:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.