Image Distortion
Image Distortion
When we cannot control the aspect ratio of the images in the web page, it is best to consider in advance and provide solutions when the image aspect ratio is inconsistent.
In the example below, we have a card component with a photo. It looks good.
At that time, if the aspect ratio of the image used was inconsistent, the image would be stretched:
The simplest solution is to use CSS object-fit
.
.card__image {
object-fit: cover;
}
Example
object-fit: cover
Adjust the container size to see the effect