Open In App

What is the <picture> Element used for in HTML5 ?

Last Updated : 31 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

The <picture> element in HTML5 is used for responsive image rendering. It allows developers to provide multiple sources of an image and define different versions based on factors like screen size or resolution.

This also ensures optimal image display across various devices, promoting a more efficient and visually pleasing user experience without the need for additional scripting or complex CSS.

Usage

  • Facilitates responsive design by adapting images to various screen sizes and resolutions.
  • Allows inclusion of multiple image sources within the <picture> element.
  • Supports art direction, enabling the selection of the appropriate image based on specific conditions.
  • Provides a fallback <img> tag for browsers that do not support the <picture> element.

Syntax

<picture>
Image and source tag
<picture>

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads