<?xml version="1.0" encoding="utf-8"?>

The bitmap image tag <img>

The bitmap image tag <img>

The <img> tag is used to insert images in the HTML documents — most commonly a BMP, GIF, PNG, or JPG file. <img> is an empty element and contains attributes only. The required attribute is src, indicating the location of the image linked. However, the best practice is to add the alt text attribute alt with a meaningful description of the image and width and height for better loading.

Most modern browsers support embedding SVG vector images with the <img> tag. If you need to support an older browser, you can check the compatibility.

Top contributors

Navid Imani

Topics

Share

Improve your UX & Product skills with interactive courses that actually work