HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials
  • Insights
  • Verify Certificate
HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials
HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials

HTML5andCSS3.org helps developers learn modern frontend skills with practical tutorials, production-ready snippets, and fast web tools built for everyday coding.

Quick Links

  • About Us
  • Contact Us
  • Privacy Policy
  • Copyright
  • Disclaimer

Top Tools

  • Try It Editor
  • JSON Formatter
  • CSS Minifier
  • HTML Minifier
  • Base64 Encoder / Decoder

Contact

  • business@html5andcss3.org
Newsletter

Learn at your own pace, practice with useful tools, and build websites you're proud of.

© 2011-2026 html5andcss3.org. All rights reserved.

How to Use

HTML Tutorial

HTML Basics

Introduction to HTMLHTML EditorsHTML StructureHTML Elements & AttributesHTML HeadingsHTML ParagraphsHTML FormattingHTML CommentsHTML Styles

HTML Text and Links

HTML Text FormattingHTML Quotations & CitationsHTML LinksHTML Email Links

HTML Lists and Tables

HTML ListsHTML TablesTable Styling & Borders

HTML Images and Media

HTML ImagesHTML Picture ElementHTML AudioHTML VideoHTML Embed & Object

HTML Forms

HTML Forms OverviewHTML Form ElementsHTML Input TypesHTML Input AttributesHTML Form AttributesHTML Form Validation

HTML Layout

HTML Block vs Inline ElementsHTML Div & SpanHTML Semantic Layout TagsHTML Iframes

Advanced HTML

HTML Entities & SymbolsHTML EmojisHTML Head Element TagsHTML Meta Tags for SEOHTML Responsive Design

HTML References

HTML5 New TagsDeprecated TagsHTML Global AttributesEvent AttributesComplete HTML Tag ListComplete HTML5 ElementsHTML Tutorial PDF
  1. Home
  2. /
  3. Tutorials
  4. /
  5. HTML Tutorial
  6. /
  7. HTML Picture Element

HTML Images and Media

HTML Picture Element

The <picture> element in HTML is used to display responsive images that automatically adjust to different devices and screen sizes. It allows you to define multiple image sources, and the browser chooses the most suitable one based on screen width, resolution, or file type.
This helps improve loading speed and visual quality, especially on mobile and high-resolution displays.

HTML <picture> Syntax

Picture Tag Example

html

<picture>
  <source srcset="https://picsum.photos/id/237/400" media="(min-width: 800px)">
  <source srcset="https://picsum.photos/id/237/200" media="(min-width: 500px)">
  <img src="https://picsum.photos/id/237/100" alt="A scenic mountain view">
</picture>

Explanation

  • The <picture> tag acts as a container for multiple image sources.
  • Each <source> element specifies an image file and a condition for when it should be used.
  • When the screen is 800px or wider, the large image is shown.
  • For screens between 500px and 799px, the medium image is displayed.
  • On smaller screens, the browser shows the mobile image.
  • The browser checks these sources from top to bottom and displays the first one that matches the current device or screen width.
  • The <img> tag inside <picture> serves as a fallback image if none of the conditions match.

Using Different Image Formats

The <picture> tag can also be used to provide images in multiple formats.
Modern browsers can load newer, more efficient formats like WebP, while older browsers fall back to JPEG or PNG.

Various Image Format Example

html

<picture>
  <source srcset="https://picsum.photos/id/46/400.webp" type="image/webp">
  <source srcset="https://picsum.photos/id/237/400.jpg" type="image/jpeg">
  <img src="https://picsum.photos/id/237/100.jpg" alt="Beautiful landscape">
</picture>

In this example:

  • Browsers that support WebP will load photo.webp.
  • Others will automatically fall back to photo.jpg.

Advantages

  • Displays the best image for the user’s device.
  • Reduces bandwidth and improves loading speed.
  • Provides flexibility for responsive design.
  • Maintains backward compatibility with older browsers.

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesPartially

All modern browsers including Chrome, Firefox, Safari, Edge, and Opera support the <picture> element.
Older browsers that don’t support it will still display the fallback <img> tag.

Conclusion

The <picture> element is a powerful tool for delivering responsive and optimized images on the web.
By using it with the srcset, media, and type attributes, you can control how images appear across different devices, ensuring both speed and quality.
It’s an essential part of modern HTML for performance-focused websites.

PreviousHTML ImagesNextHTML Audio