css zachovať pomer obrázkov
img {
object-fit: cover;
width: 100px;
height:100px;
}
zachovať pomer strán obrazu css
/* Simply add width without height,
aspect ratio will be maintained
and height will be calculated accordingly*/
img {
width: 100px;
}
html obrázok zachovať pomer strán
Don't set height AND width. Use one or the other and the correct aspect ratio will be maintained.
zachovať pomer obrazu css
img {
display: block;
max-width: 100%;
max-height: 100%;
width: auto;
height: auto;
}