Master programming syntax, solve interactive challenges & run live code in Syntaxis Explore Arena →
Reference / HTML

<picture>

A wrapper element containing zero or more <source> tags and one <img> element to provide responsive and next-gen image formats (AVIF, WebP) with graceful fallbacks.

Syntax
<picture><source srcset="..." type="..." /><img src="..." alt="..." /></picture>

Examples

Art direction & AVIF format delivery
<picture>
  <source media="(min-width: 800px)" srcset="hero-large.avif" type="image/avif">
  <source srcset="hero-small.webp" type="image/webp">
  <img src="hero-fallback.jpg" alt="Developer platform interface" loading="lazy">
</picture>
The <img> tag is required inside <picture> as the actual render target and fallback.