This is hilarious.
This is hilarious.
This sounds pretty awesome and something we’ll have to take into account moving forward with RWD.
The practice of implementing responsive images is still in its infancy. We’ve seen a lot of ideas and suggestions for how it should be done and we’re bound to see a lot more.
Today we’re going to look at a fascinating little framework that allows you to not only automatically resize your images when the viewport changes, but also crop the images with a specific important focal point in mind. Amazingly enough, it does all this with pure CSS. Read on to see how it works.
Read it all here:
What’s the easiest way to scale background images in responsive layouts? We use an old technique and enhance it to fluidly change the aspect ratio of background images.
Responsive layouts make it possible to dynamically scale the width of a website to fit on small mobile devices as well as larger desktop computers. An element with a percentual width will have its height automatically adjusted. Its aspect ratio remains the same when it is resized.
If we want to accomplish the same with background images we must figure out how to maintain the aspect ratio of any HTML element.
Paul B. tries to answer this question:
What do you think?
The goal of a “responsive images” solution is to deliver images optimized for the end user’s context, rather than serving the largest potentially necessary image to everyone. Unfortunately, this hasn’t been quite so simple in practice as it is in theory.
The problem with media queries and responsive design at the moment is there’s no “real” way to deliver a particular content image (that’s referenced in an img tag) for different breakpoints and resolutions.
So, it occurred me to that the simplest way of dealing with content images (as img tags) in a responsive design and for retina screens was to use a spacer PNG (generally smaller than an GIF) and background images.
All it requires is a blank PNG or GIF the same size as the intended image, and then setting that image’s background to whatever image needs to be served along with background-size: contain.
It works because the spacer PNG is transparent, which allows the image’s background image to be visible. Because the background is set with CSS, it can then be changed with media queries as required to serve different images to different viewport sizes or resolutions.
And yes, it even works with serving “retina images” to the new iPad.
this is pretty AWESOME!