Web design in a retina world
Tuesday, August 7th, 2012 at 20:49 by Wolfr
I’ve been meaning to write something about retina support ever since the new retina Macbook was announced. I made a lengthy comment over at Baekdal discussing how to handle web design in a retina world. I’m reposting it here for posterity and hopefully to start a conversation.
When talking about retina graphics, I think a lot depends on what we’re talking about: layout, icons, charts, or photos.
For building layouts, I don’t think defining things in absolute widths (you [Baekdal] seem to love your centimeters) is the way of the future, mostly you’re going to want to use a clever combination of ems and percentages. We’re looking at a future where defensive design for the web is even more important than it used to be.
Using a combination of new CSS properties such as flex-box, box-sizing and calc() building these layouts will be a lot easier than it used to be (again, broad support is years away, to work in a way that works in all current browsers that matter you’re going to need to combine %-based widths with em-based widths using multiple divs)
For icons and charts – pixel fitting icons is not a thing of the past, even in this retina world, but it matters less. Icon fonts are getting big (and rightfully so) – charts should be made in SVG. Look at the chart in this NYTimes article. Sweet SVG. Done properly icon fonts and SVG won’t negatively impact loading speeds, and they are infinitely scalable. One disadvantage is that it’s just harder to do (and thus less likely to be done).
For photos, you’re [Baekdal] saying “Retina displays have four times the pixels, meaning every picture has to be four times as big.” – this would be true if you really have to serve pictures in 100% quality without any JPG compression. I think for most purposes serving a 50% bigger image is just fine. A photograph doesn’t need to be four times as big to look sharp on a retina display. A 50% increase in resolution will already most photos already indistinguishable from the actual 200% version.
If you don’t believe me try visiting this test site on an iPhone. A 50% increase in resolution also doesn’t mean double the file size (see this article and it’s example photos)
All my points aside, of course serving retina graphics will still increase page load speed. On a broadband connection this doesn’t really matter. A 14Mb article is nothing — we stream 1080p HD trailers, why not enjoy HD articles? — if you have a good connection.
What about the slow connections? There’s a big problem. Web developers need some way to figure out how good a connection is and serve approriately. My thinking is that browser makers should have a background process that tracks the available bandwidth. This property can be used in CSS media queries and Javascript (e.g. client.networkSpeed)
On my own website I’m making some assumptions in deciding whether to serve retina or not e.g. if you have a 24″ screen you’re probably not mobile. This is a solution to make some bandwidth assumptions, but not a great one. For all I know you do have a large screen but are tethering at 3G or EDGE speeds.
4 comments
If you’re looking for a relative easy way to simulate slow connections, be sure to check this out:
http://mattgemmell.com/2011/07/25/network-link-conditioner-in-lion/
(Haven’t used it myself but looks pretty usefull at first glance)
One of the solutions could be a CDN (like CloudFlare, Amazon S3) that serves a different image size based on the connection speed and/or screen resolution. So as a webdesigner you provide retina only images, but the CDN decides which image size should be returned and resizes your images on the fly (this could be pre-processed when an image is uploaded to their servers). This connection speed could be communicated through HTTP headers. On a much wider scale ISPs or web hosters could support this feature, so smaller sites can benefit from it as well.
On a side note, measuring connection speeds is pretty hard. Many ISPs provide a fast downstream in the first x seconds or first x bytes and then drop to a lower speed. Plus you have to take into consideration that people switch connections all the time (they go from wifi, to hard-wire, from home, office, to a coffee shop) and that you need to collect data first before you can calculate an average speed. This means while this data is being collected you’ll be served the heaviest images.
Another solution would be to go back to progressive loading of images. That probably means we’ll have to introduce another image format, because progressing from normal to retina images is not really how image progression works right now. The way this could work is by measuring the connection speed while downloading the first part of the image, and then further progressing to retina if the connection speeds allows it.
Thanks for the tip Jan.
Bart – these are all good ideas, this is inherently the same discussion as is going on in W3C’s responsive images working group :).
Another discussion on this subject is going on here: http://blog.futtta.be/2012/08/13/my-take-on-web-design-in-a-retina-world/
@wolfr: yeah, trackbacks are so 2006 ;-)
my main concern, as expressed in my proper blogpost: even with users on high pixel density screen and on broadband, your loss in absolute performance might still negatively impact your KPI’s (sales/ pageviews/ ad views…), “outperforming” the gain one hopes to achieve by including hi-res images. If you consider going retina, you might want to use multi-variate testing to see how (if) loading retina-ready images has a positive or negative effect in your specific context (your users on your site).
That being said; as far as the bandwidth-detection issue is concerned, I’m working on a small javascript-thingie which might help.