There's more to mobile than media queries
By Daniel Davistagawa. Wednesday, August 11, 2010 5:30:30 AM
Media Queries misunderstood?
Opera have championed media queries for several years now so we're delighted that they're finally receiving so much attention, although there seems to be some misunderstanding as to what they can achieve.
Certainly, Jason's article seems based on the fact that many web developers believe adding media queries to a site will magically make it mobile-ready. As he points out, they can indeed make the visual design mobile-friendly but are unable to affect other areas, notably the size of resources that are downloaded [1]. In the mobile environment where speed is a priority, this is like putting a spoiler on your car and saying it's ready for the race track. Having said that, calling media queries a fool's gold is going a bit too far.
Thankfully, in that page's comments Jason clarified his headline and suggested a revised summary:
He's right. In our enthusiasm to try out media queries and in our rush to skim the latest articles and tutorials, it's easy to overlook caveats and restrictions. Media queries are good at what they do but are just a single tool for a job where two or three are probably needed. In particular, combining them with JavaScript as PPK and others advocate seems to me the most practical solution for web developers to adopt at the moment [2].“CSS Media Query for mobile—particularly as it has been thus far promoted—hides tough problems and gives developers a false promise of a simple solution for designing for multiple screens.”
The benefits of a single site
One further thing that caught my attention in Jason's commentary was his question:
Opera's belief in One Web encompasses the approach of having a single site that can adapt to different devices, users and infrastructures. Like any one-size-fits-all solution, there are compromises to be made but overall the pros outweigh the cons. For the developer, there's the obvious benefit of having only one codebase, albeit possibly more complex, to update and maintain, but a couple of other benefits exist as well."I don’t understand why web developers are so obsessed with delivering the same HTML to different devices."
One is that lists and databases such as WURFL, as extensive as it is, are inevitably a catch-up solution and there's always likely to be an off-the-wall or cutting-edge device that falls between the cracks. And spare a thought for the volunteer maintainers who have to keep the database up-to-date and online.
More importantly in my opinion, however, is that the distinction between mobile and non-mobile devices is becoming fuzzier all the time. Mobile phones are becoming more computer-like, mobile operating systems such as iPhone OS and Android are appearing in tablets and even netbooks, browsers can be found in portable and home gaming devices as well as TVs, media players, digital photo frames and car navigation systems. I would go so far as to say that there are no longer PC and mobile categories—there are only devices on a sliding scale of capabilities.
Designing for low spec, slow connection speed devices and then progressively enhancing, although not a silver bullet, seems to be the best foundation for a maintainable, accessible and future-proof site. To achieve this, CSS3 media queries are an essential tool to have but equally essential is to understand their limitations and to be aware of other tools and methods available.
Notes
[1] Background images are an exception to this. If they appear within a media query, they are only downloaded when that condition is true, as are stylesheets included via @import within a media query.
[2] Opera has made available a free library for combining JavaScript detection with media query syntax.
[3] Image source: http://www.openclipart.org/detail/3292

Charles SchlossChas4 # Friday, August 13, 2010 1:04:20 PM
Cutting Spoonhellspork # Wednesday, August 18, 2010 6:11:30 PM
Opera:"Here's a shiny new tool! You can fix things with it!"
Jason:"What do you mean? I can't fix my car with one tool!"
Opera:"Look in your TOOLBOX. (Now that you only need one box)"
Points to PPK (and others) for digging in the toolbox first.
Anonymous # Wednesday, August 3, 2011 10:39:01 PM
Anonymous # Wednesday, August 3, 2011 10:39:59 PM
Daniel Davistagawa # Tuesday, August 9, 2011 1:41:56 AM
Sure. You can use media queries to display a background image only when the screen width is greater than 600 pixels, for example. In all modern browsers, this image will not be displayed if the screen width is 600 pixels or less. Most browsers will still download the image but not show it, however Opera doesn't even download it. In other words, it doesn't download resources that will not be used, based on media query rules.
Hope this makes sense.
Cutting Spoonhellspork # Wednesday, August 31, 2011 2:57:39 AM
Let's assume the use of Opera Mobile.
Now, if your phone is held in portrait mode it probably has a width of 480 or 560 pixels, which would cause the image to not be loaded.
If you rotate the device, width becomes either 800 or 960 pixels, which IS wide enough. Does the image load now?
Okay then. The opposite. You load a page in landscape format, and the image is pulled down and rendered on the device.
If you rotate the device NOW, will the image disappear because the width of the screen has changed?