/    Sign up×
Reference /Pin to ProfileBookmark

The picture tag is used to display one or more image sources with more flexibility to adjust to various screen sizes.


The <picture> tag contains one or more <source> tags and one <img> tag. The browser renders the first <source> tag that matches the current viewport width. If none of the <source> tags match, then the browser will use the <img> tag as the fallback. The required <img> tag must be the last child within the <picture> tag.

  <source media="(min-width:1040px)" srcset="img_for_larger_screens.jpg">
  <source media="(min-width:768px)" srcset="img_for_tablets.jpg">
  <img src="img_fallback.jpg" alt="Fallback image">

Browser Compatibilty


Have a code example of <picture>? Submit a codepen.io demo and we'll showcase it here

to submit a demo.


Help @reference spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 7.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ,
analytics: Fullres

legal: ({
terms: of use,
privacy: policy
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
recent_tips: (
tipper: Anonymous,
tipped: article
amount: 1000 SATS,

tipper: Anonymous,
tipped: article
amount: 1000 SATS,

tipper: @Nanditha,
tipped: article
amount: 1000 SATS,