WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I create featured images, the markup that wordpress produces has inline css. The image tag for the image has width and height parameters.

This is very frustrating: I'd like to control the image style with my own css.

How can I remove the inline style?

share|improve this question
Take a look to How to Answer[1] of mr Jiang [1]: wordpress.stackexchange.com/a/115717/14536 – qwerty qwerty Oct 10 '13 at 21:45
Inline height and width attributes can be overridden from a stylesheet. – s_ha_dum Oct 10 '13 at 21:52
No they can't. That's not how css works. Inline style overrides stylesheet rules. – bob Oct 11 '13 at 1:39

You are correct, Inline CSS will always take priority over any CSS in the stylesheet unless you're peppering your CSS with !important's and/or mile-long selectors - which is bad practice. Try checking out this other question which has the solution, Filter to remove image dimension attributes.

Hope that helps!

share|improve this answer

You set the featured image sizes in your functions file:

add_image_size( 'featured-image', 300, 100, TRUE );

Then you can style the featured image from your style.css file.

Or you can over ride the default using CSS.

.wp-post-image { 
 your declarations

Change the class for your featured image to match your theme.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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