HTML Element
Example
Displaying different images for different screen sizes; if there is no match or the browser does not support the picture element, the img element is used:
<
picture
<
source
media
=
"(min-width: 650px)
"
srcset
=
"
demo1.jpg
"
<
source
media
=
"(min-width: 465px)
"
srcset
=
"
demo2.jpg
"
<img src="img_girl.jpg" picture>Try it »
define
The picture element lets us display different images on different devices, typically for responsive design.
HTML5 introduced the
elements, each
element's src attribute URL is used.
Note: The element is placed after the last
element; if the browser does not support it, the element's image is displayed.
Browser support
The numbers in the table indicate the first browser version number that supports the element.
| Element | |||||
|---|---|---|---|---|---|
| 38.0 | 13.0 | 38.0 | 9.1 | 25.0 |