Remove inline img height and width?

I have a theme that has img{max-width:100%;} as part of the CSS

This caps the width as expected, but because the img tag has height and width in, it causes the image to vertically stretch. Is there a way to remove the inline dimensions?

If you use max-width style on your img elements you should use a corresponding height: auto style.

There’s no need to remove the inline dimensions, in fact doing so would reduce your page’s performance and potentially introduce jank (especially with lazy loading) because you’ve removed the information that gives the browser information on the intrinsic image dimensions before the image has been loaded.

Thank you for the quick CSS help rather than needing to tweak Ghost, that was exactly what was needed! :pray:t2:

1 Like