image stretching

i dont want this image to stretch is there a way to prevent it if i only set its width then if height of image is larger it becomes very big and if width is larger it and i dont use fixed width it pushes the other elements
No description
No description
2 Replies
Joao
Joao•8mo ago
Try with object-fit: cover
Benji598
Benji598•8mo ago
Hello, Try this..... img { max-width: 100%; height: auto; display: block; } this makes images responsive, if the image is to big you need to resize the image. A better way is to use something like a picture tag where you can create different size images for different breakpoints 😉 Hope this helps