Skip to content

Instantly share code, notes, and snippets.

@Simply1993
Created November 20, 2018 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Simply1993/21dfa8de464f8818aa68cb0c274f63cd to your computer and use it in GitHub Desktop.
Save Simply1993/21dfa8de464f8818aa68cb0c274f63cd to your computer and use it in GitHub Desktop.
High-DPI images, different image types & art direction use case
<!-- source: https://dev.opera.com/articles/responsive-images/ -->
<picture>
<source
media="(min-width: 1024px)"
srcset="opera-fullshot-1x.webp 1x,
opera-fullshot-2x.webp 2x,
opera-fullshot-3x.webp 3x"
type="image/webp">
<source
media="(min-width: 1024px)"
srcset="opera-fullshot-1x.jpg 1x,
opera-fullshot-2x.jpg 2x,
opera-fullshot-3x.jpg 3x">
<source
srcset="opera-closeup-1x.webp 1x,
opera-closeup-2x.webp 2x,
opera-closeup-3x.webp 3x"
type="image/webp">
<img
src="opera-closeup-1x.jpg" alt="The Oslo Opera House"
srcset="opera-closeup-2x.jpg 2x,
opera-closeup-3x.jpg 3x">
</picture>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment