Image Tag

The <img> element embeds an image in a page. It is a void (self-closing) element whose src attribute points to the image file and whose alt attribute describes it in text.

Web

The alt attribute is important: screen readers read it aloud, and browsers show it if the image fails to load. Always provide meaningful alt text (or alt="" for purely decorative images).

Modern images often use width and height attributes to reserve space and improve loading performance.

Examples

HTML

<img src="logo.png" alt="Company logo" width="120">

Output:

Renders the logo.png image at 120px wide with the alt text 'Company logo'.

Learn it in a lesson

See also

Back to the Dictionary