Junior From PDF JavaScript JavaScript

What is the purpose of the <picture> tag?

<picture> allows serving different image versions depending on device, screen size, or

media type.

Example:

<picture>

<source srcset="photo-large.jpg" media="(min-width: 800px)">

<source srcset="photo-small.jpg" media="(max-width: 799px)">

<img src="photo-default.jpg" alt="Beautiful landscape">

</picture>

Key Takeaway:

Use <picture> for art direction — showing different images per device or context.

More from JavaScript Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details