The image element embeds an image into the document.

The image's path or URI can be a relative or absolute type and it is defined via a src attribute. The other important attribute is the alt attribute which stands for alternate text and it suppose to contain a short description of the image inserted.

Browser will show the alternate text when the image is not possible to load or if it is a non-visual type of browser.

Common image compression types that are recognizable across all browsers are gif, jpeg (jpg) and png.

Image is an empty element, therefore the closing tag is forbidden.

Syntax:

<img src="URI" alt="" />

Attributes:

Example

HTML image element:

 

›› go to examples ››