<picture>: The PICTURE Element

Last updated: 2026-10-13

<picture>The PICTURE Element

Provides multiple image sources for an img, letting the browser pick the best one by viewport, resolution, etc.

CategoryLinks & Media
Content ModelFlow content
Allowed ParentsAny element that accepts flow content
Content TagYes — requires closing </picture> tag
StatusStandard

📝 Syntax

<picture>image sources</picture>

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
<picture> ✓ v1 ✓ v12 ✓ v1 ✓ v1 ✓ v1
Supported in all major browsers
Tip: picture must contain an img as fallback; source only chooses, the img is always what renders.

❓ FAQ

QWhat is the difference between picture and img?
A<picture> is a 'format/crop selector' for img: it holds several <source> elements plus one fallback <img>, and the browser picks the best resource (newer format, different crop). img alone loads a single resource. Note that picture renders nothing itself — the swapping happens on the img.
QHow do I provide a WebP fallback with picture?
APut the new format in source and the old one in img: <picture><source type='image/webp' srcset='a.webp'><img src='a.jpg' alt='…'></picture>. WebP-capable browsers pick the source; the rest fall back to the jpg in img.
QHow does the media attribute of picture work?
APut a media query on source to serve different crops per screen: <source media='(max-width: 600px)' srcset='small.jpg'>. The first matching source wins, evaluated in document order; the fallback is always the img.
More case studies coming soon — check back later.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏