Stretch an image with HTML

12 Jan

If you want to stretch an image depending on how wide it’s container is, you can do so with a relative width in your width attribute. It’s pretty easy to do, does not look so nice, but often asked about.

Example:

Stretched imageStretched 50%

HTML:


<img src="image.jpg" width="100%" height="150">

<img src="image.jpg" width="50%" height="150">

No comments yet

Leave a Reply