How to fit image size to div size in HTML

To fit image size to div size in HTML you need to set max-width and max-height without applying an explicit width or height.

Sample HTML

max-width:100%;
max-height:100%;

Please Share us:
Please rate this snippet

5 thoughts on “How to fit image size to div size in HTML

Leave a Reply