WordPress Code Snippets

A fresh mix of code snippets and tutorials

Override inline CSS styles

68

Quick tip for overriding inline CSS styles from within your stylesheet.

If you’ve got some tag with style="whatever:value;" stuck in it, you can override the inline style(s) from within a stylesheet. Here is the general code:

element[style]{ 
	some: property !important;
}

So for example, if we have this inline style in the markup:

<img src="example.png" style="border: 1px solid gold;" />

We can override it via the stylesheet with this:

img[style]{
	border: 0 !important; 
}

Show Support

Like our new Facebook Page to show support!