This method sets the image size using HTML width
and height
attributes.
Here, CSS is used to define the image dimensions.
Using width: 100%
and height: auto
makes the image scale with its container.
Setting only the width and letting the height adjust automatically preserves the image's aspect ratio.
Using CSS background-size: cover
to resize background images.