Page 1 of 1

How to CSS an image to not go wider than it's loaded size

Posted: Mon Aug 07, 2017 9:02 am
by simonmlewis
We have a Wordpress Blog and we have overwritten some CSS so the DIVs go wider. However the images inside the DIV are stretching too.

One image is loading at 590px, but it stretching at full width.

I thought this would stop it:

Code: Select all

#grve-single-media img
{
max-width: 100% !important;
}
As I thought max-width loads it to 100% only, if it's designated size.

What is the right way to make sure any image there loaded, never go wider than it's core width? ie. 590. But some maybe 790, 850... etc.

Re: How to CSS an image to not go wider than it's loaded siz

Posted: Mon Aug 07, 2017 9:03 am
by requinix
Images don't naturally stretch, so if that's happening then you have some CSS somewhere responsible for it.

Re: How to CSS an image to not go wider than it's loaded siz

Posted: Mon Aug 07, 2017 9:29 am
by simonmlewis
YEah. I tried width: auto; and that did it. ta.