responsive design was easy
@media only screen (max-width: 320px) { }
@media only screen (max-width: 320px) { }
@media (max-width: 20em) { }
img{
max-width: 100%;
height: auto;
}
and we were lost.
@2x = 4 times larger files
(+ don't even think about using CSS backgrounds)
…until I bought an Amazon Kindle
but they have a black'n'white display.
just displayed me images like that way:
but no one had an answer.
Got response by WHATWG and was disillusioned
I saw an email in WHATWG mailing list
not only were back again but got support by W3C!
and over 180 people joined conversation
<picture>
The result of our work for months
<picture>
<source src="small.jpg" media="(max-width: 20em)">
<source src="normal.jpg" media="(min-width: 20em)">
<source src="image.tiff" media="print">
<img src="small.jpg" alt="fallback image">
</picture>
too long, too much.
to the rescue
<img src="fallback.jpg" alt="" srcset="small.jpg 640w 1x, small-hd.jpg 640w 2x, med.jpg 1x, med-hd.jpg 2x ">
So why the fuck am I telling you this?
and it's called Polyfill
The picturefill allows you to use sort of <picture> today
github.com/scottjehl/picturefill
<div data-picture data-alt="alt text">
<div data-src="small.jpg"></div>
<div data-src="medium.jpg" data-media="(min-width: 400px)"></div>
<div data-src="large.jpg" data-media="(min-width: 1000px)"></div>
<noscript>
<img src="external/imgs/small.jpg" alt="alt text">
</noscript>
</div>
We all know we should use a CDN
(automatically)
…and it saves your time!
Find an OpenDeviceLab near you!
opendevicelab.com*
* takeoff on Monday