To force image to resize and keep aspect ratio with CSS, we set the width and height to auto.
For instance, we write
img {
display: block;
max-width: 230px;
max-height: 95px;
width: auto;
height: auto;
}
to set the max width and height of the img element.
And we set the width and height to auto to make the image keep its aspect ratio while keeping the size as close to the max width and height as possible.