I have images that are 1000px wide by 250px high. I've made the images responsive/flexible by using
img {
max-width:1000px;
height:auto;
}
All the images should be in this ratio of 1 to 1/4.
However the client will from now on be using a CMS to replace and update images. I have no control over the dimensions of these new images. The CMS isn't capable of scaling and cropping the new images to the required format. I have been told to use object:fit. Such as:
img {
width:1000px;
height:250px;
object-fit:cover;
}
However these means the images are not responsive/flexible. Is there a way to keep the images responsive and for the ratio to stay the same?
I've tried the following but they don't work:
img {
max-width: 100%;
max-height: 252px;
object-fit: cover;
}
and
img {
max-width: 100%;
height: auto;
object-fit: cover;
}
I could use background images and the padding-bottom:25% trick, but I'd rather use images and alt tags.