SureshTechs
HTML
Picture Element
Purpose
• The picture element allows us to display different pictures for
different devices or screen sizes.
Different sizes
Desktop
Mobile
<picture>
• The <picture> element contains a number of <source> elements, each
referring to different image sources.
• This way the browser can choose the image that best fits the current
view and/or device.
• <picture>
<source media="(min-width: 650px)" srcset="img_desk.jpg">
<source media="(min-width: 465px)" srcset="img_mob.jpg">
<img src="img_default.jpg">
</picture>
Note
• Always specify an <img> element as the last child element of the
<picture> element.
• The <img> element is used by browsers that do not support the
<picture> element, or if none of the <source> tags matched.
When to use the Picture Element
• 1. Bandwidth
• 2. Format Support
Thank you