<figure>
<img src="/charts/revenue.png" alt="Bar chart showing 40% revenue growth year over year">
<figcaption>Revenue growth from2023 to 2025</figcaption>
</figure>
Note figure is for self-contained content that could be moved to an appendix without losing meaning. The figcaption provides a visible caption, while alt describes the image content itself.
Note The browser picks the first matching source. Always include the img fallback as the last child. Use picture for art direction (different crops at different sizes) or serving modern formats with fallbacks.
Note The w descriptor tells the browser the intrinsic pixel width of each image. sizes tells it how wide the image will display at each breakpoint, so it can pick the best file. This is for resolution switching, not art direction.
<img src="/gallery/photo-42.jpg" alt="Sunset over the canyon" loading="lazy" width="600" height="400">
Note loading="lazy" defers loading until the image nears the viewport. Do not lazy-load images that are visible on initial load (above the fold) since it slows their appearance. Use loading="eager" (the default) for hero images.
<video controls width="720" height="405" poster="/thumbs/demo.jpg">
<source src="/videos/demo.webm"type="video/webm">
<source src="/videos/demo.mp4"type="video/mp4">
Your browser does not support video playback.
</video>
Note Provide multiple source formats for compatibility. The poster attribute shows a thumbnail before playback. Avoid autoplay with sound since browsers block it and users dislike it.
embed videovideo playervideo tagplay video
Audio
syntax
<audio src="url" controls></audio>
example
<audio controls>
<source src="/audio/podcast-ep12.ogg"type="audio/ogg">
<source src="/audio/podcast-ep12.mp3"type="audio/mpeg">
Audio playback is not supported in your browser.
</audio>
Note Like video, provide multiple source formats. The controls attribute gives users play, pause, and volume UI. Without controls, the element is invisible.
embed audioaudio playerplay soundmusic playerpodcast player
Decorative Images (Empty Alt)
syntax
<img src="url" alt="" role="presentation">
example
<img src="/images/decorative-divider.svg" alt="">
Note For purely decorative images that add no information, use an empty alt attribute. Screen readers will skip them entirely. Never omit the alt attribute since that causes readers to announce the file name.