Navigation

Stop chasing screen resolutions

By Adam Fairhead | Web Design, Web Development | Dec 3, 2012

We live in such an exciting time in the world of the web. Technology and standards are moving forward at a rate that’s perhaps both faster and more exciting than ever. As things change, so do our habits, and one area that I think has seen bigger changes than most would have to be the change in resolution that our devices are now running.

Resolution is a funny thing to measure; it’s not a physical size change, but a clarity change. It’s not making images, brighter, or more rich in color, but making them denser. It’s also something that people seldom understand the value of until they see it for themselves.

Of course, when we get a taste of high-resolution displays, we’re hooked. And we all want our websites (and the websites of our clients) to look awesome on the devices that are sporting these displays. Many web designers are racing towards that goal by creating images for each new resolution that comes our way. Or, as I’m calling it in this article, “chasing screen resolutions”.

 

An introduction to SVG

Many of us know what SVGs (Scalable Vector Graphics) are. We’ve seen it on the W3C HTML5 website, under “3D, Graphics & Effects”. SVG is a standard HTML5 technology, that displays images with code. Or something.

At least, that’s the general response I got when I asked people about SVG graphics. It’s not really something people are interested in, because its value isn’t fully understood.

I want to show you how to avoid “chasing screen resolutions”, and it just so happens that the SVG standard can help us do just that.

 

The state of retina graphics

When I say “retina graphics”, I refer to any devices that have a screen resolution higher than that of traditional displays, sporting a resolution way above 72ppi (pixels per inch).

Apple famously smashed the 72ppi barrier with the iPhone 4, a device that had a fantastic new high-resolution display, that looks unlike anything else we’d seen before. Except when you used it to browse the web… the web looked rubbish.

The web had 72ppi optimized images. At the time of writing this, most of the web still does, two years after the launch of the iPhone 4.

Now, we have all sorts of devices with Retina quality Graphics. It’s slowly making its way across the entire Apple product line, extending to the iPod Touch, iPad and even the latest MacBook Pro. Smartphones are popping up all over the place with high resolution displays, so much so that a “standard” resolution display almost feels old-hat at this stage.

Still resolution dependent

When the web design community overcame the blurry images problem with conditionally loaded @2x images (images that were created to be twice the size of their original counterparts, loaded only on high-res devices), the web looked good again, for the most part. Some designers even advertised their websites as “resolution independent”.

Of course, what they really should have advertised their sites as was “optimized for two screen resolutions”.

Devices will keep on getting better, resolutions will keep on getting better, and and the web will continue to be enjoyed on an increasing number of form-factors. What about the inevitable future @3x? What about @4x? What about if the standard “1x” becomes unnecessary? What makes 3x “@3x” and not “@2.5x”?

Messy indeed.

What’s more, this sort of technique is hardly widespread. I browse the web on the aforementioned MacBook Pro with Retina Display, and most of the web is sadly exactly where it always has been since the iPhone 4: blurry. Creating all of your web imagery again is an arduous sounding task, especially when the whole web design world has been designing with bitmaps for so long.

Unzoomable web

Even today, with our @2x images, we still can’t zoom in on web pages without them going ugly again. Text manages a zoom just fine, but by comparison, images just cry out for those future @4x exports (something that no one will deem appropriate to serve just on the off-chance that someone might like to zoom in 4x on your RSS icon).

 

Going truly resolution independent

The problem is with bitmapped images. We’ve always known that they don’t upscale, and now is no different. What we need is vector graphics on our websites. Vector graphics are calculated by a series of instructions, rather than baked onto a grid where each pixel represents a color. Enter, SVG.

One size fits all

Since SVG graphics are vector graphics (hence the name “Scalable Vector Graphics”), they’ll look awesome on yesterday’s, today’s and even tomorrow’s screen resolutions. Additionally, due to the formulaic nature of vector graphics, you can zoom in on any device and images will stay looking great.

Faster load times

Making a 2000px by 2000px image, to a web designer, sounds nothing short of ludicrous. It would take far too long to load, it would bring some mobile devices to their knees, and the 4000px x 4000px “@2x” version would be craziness. And as resolutions get better and better, it’s simply unsustainable. With SVG, since it’s a vector format, it doesn’t matter if the image is 20px or 2000px; the load time will be exactly the same. The only thing that makes a difference to the load times is the complexity of each image file.

You can use it today

SVG may not be supported across the board, but Modernizr can feature-detect it. By serving a SVG and non-SVG version, you can reap all the benefits of SVG, while leaving legacy browsers with a @1x PNG. It’s as simple as this:

.no-svg .logo { background: url('logo.png'); }
.svg .logo { background: url('logo.svg'); }

 

Limitations of SVG

It’s not difficult to create SVG graphics out of any vector based image. Many pro apps such as Adobe Illustrator and Inkscape can export to SVG natively. There are a few things that you’ll need to know about SVGs for the web, however.

They can’t contain bitmap images of any kind.

Sure, you can add them in SVG authoring applications such as Illustrator or InkScape, and save your work as SVGs, but they won’t render where it matters: your web browser. CSS wizardry will be necessary to load a bitmap on top of the SVG where appropriate.

Can take forever to load if complicated

If you make a complicated SVG, you’ll be hit with load times not unlike the aforementioned 2000px x 2000px image. You wouldn’t want to draw a complex painting in SVG format, for instance.

Gotta keep it simple

Apps like Illustrator and Inkscape can do much more than your web browser can handle. They’re full blown illustration apps, not web SVG creator apps. In fact, it’s safe to assume that 90% of the functionality that those kinds of application offer will be unavailable to viewers on the web. If you’re familiar with vector software, you’ll need to learn alternative ways to create the effects you’ve come to love.

Try to learn the language

SVG code isn’t something you can “see in your mind” like you can when you read HTML. It’s a series of instructions mapped respectively against one another, element by element, layer by layer. Unfortunately, as of today, you’ll probably have to dip in there from time to time, since there are some results even Adobe Illustrator doesn’t offer.

For instance, images in Illustrator have a canvas you draw on; it’s a set width by a set height. That’s great, but if you want to control those details in the browser, you need such information to be stripped away from the SVG itself (note: some browsers will interpret your CSS irrespective of any declared SVG dimensions, but not all do). It’s not particularly hard, but it can be a headache. It’s well worth spending a bit of time getting to know the language, so that you can manipulate SVGs even further.

 

SVG in the Wild

Logos

Logos should typically be in a vector format anyway, so they’re a great way to bring SVG into your website designs. By using the markup above, you have everything that you need to take your first SVG elements online.

 

Icons

Icons are a great candidate for SVG. So much so that I’ve created a full icon set using SVG graphics. The scalable nature of SVG means that the icons can be used at any size, accommodating a broad range of site designs.

 

Animations

Animations also make a great case for SVG graphic usage. Since animations are typically tethered to a fixed width and height, SVG goes some way towards helping animations get responsive. Flash used vector graphic elements, now HTML5 animations can too.

 

Background images

Background images have always been a tricky point for web developers; the potential load times, as I mentioned above, can be crazy. SVG background images can be as big as you like; they still have snappy load times providing they aren’t really complex.

 

Conclusion

All in all, resolution independence is a fantastic goal for web designers and developers alike to strive towards. It’ll even mean their design tastes will be out of date before their site imagery is. While it’s important to approach them with your eyes open, it’s pretty clear to see how SVG graphics can move you closer to a future of total resolution independence.

When you load up an SVG enabled site on a high resolution device like an iPad 3, and you zoom in, you’ll be sold.

I hope this article goes some way towards encouraging resolution independent thinking in web design and development, and I hope that it has encouraged some of you to think about how SVG can work for your next site.

I’ve been in the SVG pool for a while, and I have to say, the water has never been more lovely.

 

Are you an SVG convert or do you serve scaled bitmaps for retina displays? Are vectors the future of web graphics? Let us know in the comments.

Featured image/thumbnail, vector image via Shutterstock.

Share this post
Comments (no login required)
  • http://www.facebook.com/tomCrielly Thomas Crielly

    Until they can ‘handle’ bitmaps, svg is of limited use on a lot of websites – no point in having vector style imagery look great when other images/photos/illustrations/artwork etc on the site look rubbish – it’s only a part fix and i can’t think of too many sites that i’ve been on that could utilise vector appropriate imagery only. Good idea but very limited – someone need to come up with a solution to handle bitmaps

    • http://www.facebook.com/ChakibTsouli Chakib Tsouli

      Let’s take a look at Vimeo.com; their website is nothing but vector graphics from the header to the footer. So SVG graphics would be the ideal solution for them. But when we inspect their website, we find out that that they’re still using Jpeg & PNG while they can use SVG in 99% of the website for a neat look in all screens.

      Of course SVG is a new technique, but there are some sites that can benefit largely from it.

    • http://www.testshoot.com/ TestShoot

      Internet pixie dust. Content like images (bitmaps)… That harsh reality was carefully averted to talk about the red herring that is responsive design.

  • http://twitter.com/feindura feindura CMS

    I think SVG and vectors is the future, but CSS3 is also pretty well a kind of SVG. You can create borders, rounded, shadows etc.. i would go for CSS3 and when necessary, like the fairhead example above, use SVG.

    • http://twitter.com/One_div One div

      Yes you’re right! I created a CSS icon database that could be an alternative to SVG ;).
      http://one-div.com

  • http://www.boostinspiration.com Boost Inspiration

    Nice to see how the author is using SVG in his website. Great example.

  • Randy Sizemore

    I’m all on board in theory but my attempts have been a big fat fail. I’d love to find resources or tutorials that held my hand all the way through implementation (realize my 2 handicaps: 1. I’m not a developer… Classically trained artist, who taught himself coding skills to bridge the gab between developer and designer. 2. I’m old ;) over 25 years in design industry.)

  • marcelkalveram

    Great article, and interesting approach. A good developer should in my opinion have in mind the advantages and short-comings of all techniques (@2x vs. SVG vs. responsive images) and use the appropriate one in each case. There is no perfect solution yet, but I’m glad you shared your insights, I’ve learned something new and I may want to try out the SVG way in one of the upcoming projects. Thanks

  • mm

    I hate the fact that people are conforming to what Apple tells them. Apple is 75% fashion statement. There is nothing like waiting for images to load on an AT&T service, esp. when Google prefers mobile experiences to be under 40kb.

    And web developers welcome to the 25 year secret of vector graphics

  • http://twitter.com/silksterweb Dan Silk

    Font-Awesome is an easy way to ease into SVG. It has many common icons available that scale beautifully to any size. It was made to work with Twitter Bootstrap, but works fine on its own.

    http://fortawesome.github.com/Font-Awesome/

  • bgbs

    I can only see svg used effectively on icons, but everything else, its use is limited. Innovation in higher screen resolution has launched a trend into illustrative based websites. We will see less images and more illustrations in web design projects. News and blogs, of course, cannot do this, because all their articles almost always require photos.

    The true solution I think has to be server based. Apache, and other web servers have to be equipped to automatically serve the correct image size for particular display. You shouldn’t be supplying 1x, 2x and responsive images, you should supply only one higher rez image and the server should resize the image to different sizes to serve to sever on all devices. Front end solutions, that are currently used are daunting, and time consuming.