Learn about using images in web pages.
Images can be added to a HTML web page using
<img> tag. Image tag element does not contain a closing tag. Following are the attributes of HTML img tag element.
|src||relative or absolute url||source address of the image and this is mandatory.|
|alt||text||if the image cannot be displayed for any reason, then this alternate text will be displayed.|
|width||number in pixel or percentage||display width to be used in browser to show the image. Image will be stretched or shrinked to fit the given number.|
|height||number in pixel or percentage||display height to be used in browser to show the image. Image will be stretched or shrinked to fit the given number.|
|longdesc||URL||URL of a description of the image, which supplements
<img>tag can be used within any HTML tag element that allows to embed a content, for example
- General image formats that are supported by common browsers are JPEG, GIF, PNG, SVG, BMP.
HTML Image <img> Example
<img src="html.jpg" alt="html">