Bruce Lawson, Opera Software
<picture>srcset attributesizes attributequick to react in the way that is needed, suitable, or right for a particular situationMacmillan Dictionary
quick to react in the way that is needed, suitable, or right for a particular situationMacmillan Dictionary
0.5 second delay = 20% drop in traffic (Google). 100ms delay = 1% decrease in sales (Amazon)How a Slow Website Impacts Your Visitors and Sales
1 sec delay causes 7% drop in conversions (GlassesDirect)Tag Management Blog
5 sec improvement in page load time resulted in 5% – 12% increase in revenue (Shopzilla)Velocity Conference
Q: How can I send super high-quality (=huge) images to retina devices but normal quality images (=smaller file size) to devices with non-retina/ small screens?
A: I can't.
<img src="blah.jpg">
<img id=lovely src=mankini.png
alt="Bruce in a mankini">
@media all and (max-width:320px) {
#lovely {content: url(lowres-mankini.png);}
}
Steve SoudersOne study showed preloading makes pages load ~20% faster.
I think preloading is the single biggest performance improvement browsers have ever made.
<video>
<source src=foo-lowres.webm media="max-width:480px">
<source src=foo-hires.webm>
<!-- Fallback content -->
</video>
Notes on Adaptive Images (yet again!) (Dec 2011)
<picture>
<source src=foo-lores.jpg media="max-width:480px">
<source src=foo-full.jpg>
<!-- Fallback content -->
<img src="foo-lores.jpg" alt="…">
</picture>
srcset x descriptor<img src="normal.jpg"
srcset="hi-res.jpg 2x"
alt="…">
srcset x descriptor<img src="normal.jpg"
srcset="hi-res.jpg 2x, super-res.jpg 3x"
alt="…">
<img src="mankini.png" alt="lovely">
…
img {max-width:100%;
height:auto;}
On the test page with 6x images (not unusual at the moment on many responsive sites), the combination of resizes and decodes added an additional 278ms in Chrome and 95.17ms in IE (perhaps more …) to the time it took to display those 10 images.Why We Need Responsive Images: Part Deux
w descriptor<img src="medium.png"
alt="mankini"
srcset="big.png 960w,
small.png 240w">
<img src="medium.png"
alt="mankini"
srcset="big.png 960w,
small.png 240w"
sizes="100vw">
<img
src="opera-400.jpg" alt="The Oslo Opera House"
sizes="(min-width: 640px) 60vw, 100vw"
srcset="opera-200.jpg 200w,
opera-800.jpg 800w,
opera-1200.jpg 1200w,
opera-2000.jpg 2000w">
WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller in size compared to JPEG imagesMore, conversion tools
<video>
<source src=foo.webm type=video/webm>
<source src=foo.mp4 type=video/mp4>
<!-- Fallback content -->
</video>
<picture>
<source srcset="tree.webp" type="image/webp">
<img src="tree.jpg" alt="tree">
</picture>
webp= 25K, jpg=38K
<picture> just magically changes which image the <img> pulls in to display.
Check currentSrc in JavaScript to see what’s chosen by the browser.
<picture>
<source
media="(min-width: 1024px)"
srcset="whitehouse-fullshot.jpg">
<img src="whitehouse-closeup.jpg"
alt="Dog in front of white house">
</picture>
srcset "in development", <picture> "under consideration"srcset x descriptors (iOS 8.1), <picture> ??Because responsive images require use of <img src>, no-one gets a worse experience than they do now.