<picture>...</picture>

HTML4 HTML5

Used for flexible serving of responsive images[cite: 3]. This container allows defining multiple image sources (<source> tags) depending on screen resolution, browser window width, or supported file formats, ending with a default <img> tag[cite: 3].

Both opening and closing tags are mandatory[cite: 3].

Attributes:

Example

Code:

<picture> <source media="(min-width: 650px)" srcset="https://picsum.photos/300/150"> <source media="(min-width: 465px)" srcset="https://picsum.photos/200/100"> <img src="https://picsum.photos/150/100" alt="Sample image" width="150" height="100"> </picture>

The browser will interpret this code as follows:

Sample image