css maintain aspect ratio code example
Example 1: keep aspect ratio of image css
img {
display: block;
max-width: 100%;
max-height: 100%;
width: auto;
height: auto;
}
Example 2: aspect-ratio css
aspect-ratio: 1 / 1;
img {
display: block;
max-width: 100%;
max-height: 100%;
width: auto;
height: auto;
}
aspect-ratio: 1 / 1;