[theme-reviewers] Using wp_enqueue_style() With IE Conditionals

Otto otto at ottodestruct.com
Thu Apr 21 22:07:12 UTC 2011


On Thu, Apr 21, 2011 at 4:59 PM, Curtis McHale <curtis at curtismchale.ca> wrote:
> Funny on personal projects I put my stylesheet after wp_head so I can
> override the enqueued stylesheets for plugins that don't let you turn them
> off or are way over qualified and make it hard to write CSS rules that kill
> them. I know it's not best practice but it's way easier than fighting plugin
> CSS all day.

The problem is that stylesheet order doesn't actually matter. CSS is
all about specificity of the definitions.

For overriding plugin CSS, usually I can get away with the simple
trick of adding "body" to the front of their own rule definitions. So
if they use "div.xxx span.yyy", then I can override it with "body
div.xxx span.yyy".

Having it load your CSS later really doesn't accomplish anything.
You're relying on an undefined behavior that is specific to the
browsers you're testing with. Later rules doen't actually override
earlier matching ones in the spec, it's just the way your browser
happens to work.

-Otto


More information about the theme-reviewers mailing list