You don’t serve a mobile version, you serve a version that can work on mobile (generally very basic styles). Your desktop css adds to that.
I’m not done testing with mine, but I have one page/project which I tried to apply this idea.
The “main” css sheet deals with background colours, text, fonts, and watnot.
The “desktop” CSS builds on that by adding floats and things.
This should mean those only loading the “main” css sheet is NOT sending requests to the server for CSS background images such as used in image replacement!
IE reads them both, without the media query parts, and all IEs under 9 get what would be the full-width desktop experience (this means they DO get scrollbars if they are under the 990px width I’ve set). But, I am also making the assumption that IE is going to be used on a Desktop… I know this isn’t always true, but then, I tell myself, I normally don’t have any mobile stylesheet anyway. As this is an IE bug, other browsers on mobiles who don’t support media queries should do what IE does if I leave out the comma: not load the “desktop” css and ignore the entire line.
So instead of “handheld” and “mobile”, I have “basic” and “desktop”. So assuming I was going to support mobiles all along, I don’t have an “extra” stylesheet… I would have needed another one anyway (and if you saw how Simon Colllison’s site appears in various mobiles in the slides, you know that yes, you would have needed another stylesheet anyway… and then they may have been ignored by the phone! Arg).
This is what I have so far (and no, it’s not finished, it’s not cross-browser tested… very early stages):
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type="text/css" media="screen, projection, handheld" href="scooter.css">
<link rel="stylesheet" type="text/css" media="screen, projection and (min-width: 600px)" href="desktop.css">
I’m not using “all” because when I do print sheets, I like to start from 0, not negate everything stated in the screen stylesheets. Too much work.
All browsers, and mobiles, should get the basic sheet called “scooter”.
This would style this much.
Layer on the desktop version, and you get this.
IE6 and 7 will load the desktop.css because I have a comma separating my media types. It’ll ignore the rest and just load it.
There’s a single media query inside the desktop.css and same thing, added a comma. IE8 is funny… the comma-bug is present for the stylesheets called by the markup, but not for the single @media rule I have within my desktop stylesheet. Which is interesting because 6 and 7 lap it up. But I prolly won’t be using the comma-bug in-sheet because it seems to break FF anyway. *edit: it’s removed
Firefox 2 does not understand media queries and so what you get is just the basic styles, not the desktop styles. Then again it also doesn’t understand inline-block without hacks and I’m using that freely as well. Whatever. This means the page is ugly in all the older-of-the-modern browsers: older Safari (older than 3), older Opera (older than 7), not sure about Chrome (did it always support?), and IE6 doesn’t get max-width so even on mobile-basics only it doesn’t do too well… however I’ve been thinking of giving IE6 something entirely different just for fun (and code bloat lawlz), dunno if I’ll do that though.
Worst comes to worst, I have an UGLY page. It should still be a USABLE page regardless, and actually I’m already reconsidering my layout for that page anyway… that text is inherited and may get chopped by the big guys here anyway. While re-doing it, I’m certainly going to be using IE6 and K-Meleon (which is a current, updated browser still using the Firefox2-age Gecko) to see what I’m getting in non-media-query-supporting desktops.