img {
width: 100%;
height: auto;
}
The above code adjusts the width of the images to match the width of the page, while maintaining the original aspect ratio with the height.
However, if we were to use the following:
img {
width: auto;
height: 100%;
}
Why doesn't this code resize the image's height to fit the height of the page, while still preserving the aspect ratio with the width? Are there other methods available to achieve this effect on my image?