Meaningful alt and decorative alt=""
<img src alt width height>
<img src alt="" width height>Provide a text equivalent, or use an empty alt for a decorative image. Do not omit the attribute.
| Attribute | Description |
|---|---|
src | URL of the image resource. The examples use local documentation file names and are not fetched here. |
alt | Required as a decision. A non-empty string is a text equivalent. alt="" marks a decorative image. Omitting alt is not equivalent to alt="". |
srcset, sizes | Optional candidates and size hints for responsive images. Not required for the examples on this page. |
- This is a markup rule, not a measured screen-reader announcement.
<figure>
<img src="garden.jpg" alt="A raised garden bed with labeled herb rows" width="640" height="360">
<figcaption>Spring planting layout</figcaption>
</figure>
<img src="divider.svg" alt="" width="120" height="8">What this markup means
The photograph has a short text equivalent because the picture itself carries information. The divider is decorative, so alt is present and empty. Neither path is loaded by the documentation checker.
Related: Tag catalog: <img>, HTML tutorial: Practice