On this page
<picture>
Prev: `<img>` | Up: media | Next: `<figure>`
Rel: media, Tables & Media Guide
Ref: MDN Web Docs — <picture>
Tags: #public #web #html #elements #media #tier/standard
Summary
Selects image formats (AVIF/WebP) or responsive crops via <source> children.
- Implicit ARIA Role:
none (wraps img) - DOM Interface:
HTMLPictureElement - Key Attributes:
(contains source + img)
Notes & Best Practices
- Art direction and modern formats (
avif/webp): Always include a fallback<img>as the final child (which holds thealt,width, andheight).
Example
<picture>
<source srcset="hero.avif" type="image/avif" />
<source srcset="hero.webp" type="image/webp" />
<img src="hero.jpg" alt="Product overview" width="800" height="450" />
</picture>
Linked from
Related notes
- tuts/html/elements/media/figure Linked here; links to this page; shared tags: #elements, #html, #media, #tier, #web
- tuts/html/elements/media/img Linked here; links to this page; shared tags: #elements, #html, #media, #tier, #web
- tuts/html/elements/media Linked here; links to this page; shared tags: #elements, #html, #media, #web
- tuts/html/elements/tables_and_media Linked here; shared tags: #elements, #html, #media, #web
- tuts/html/elements/media/canvas shared tags: #elements, #html, #media, #tier, #web
- tuts/html/elements/media/marquee shared tags: #elements, #html, #media, #tier, #web
- tuts/html/elements/media/svg shared tags: #elements, #html, #media, #tier, #web
- tuts/html/elements/media/table shared tags: #elements, #html, #media, #tier, #web
- tuts/html/elements/media/video shared tags: #elements, #html, #media, #tier, #web
- tuts/html/elements/forms/button shared tags: #elements, #html, #tier, #web