CSS menjaga rasio gambar
img {
object-fit: cover;
width: 100px;
height:100px;
}
monospace
img {
object-fit: cover;
width: 100px;
height:100px;
}
img {
display: block;
max-width: 100%;
max-height: 100%;
width: auto;
height: auto;
}
.image-full {
background: url(...some image...) no-repeat;
background-size: cover;
background-position: center center;
}
Don't set height AND width. Use one or the other and the correct aspect ratio will be maintained.