I have been trying to determine how the viewport -- and the contents within -- are affected by the viewport meta tag used for drawing content with WebView or with the native
$(document).ready(function() {
$('meta[name=viewport]').attr('content','width=1024, user-scalable=no');
});
Seem to work for disabling the user scaling after the correct scaling have been applied
Interesting can of worms you've opened up there. As you try out more devices you'll probably see even more weirdness, and random bugs. Interesting times! :-)
I suspect that somewhere down the line you might want to give up, and just try to...
border-image
s as well as background-image
s coupled with the well-supported background-size property1 to make things render nice and crisp2.1) To provide backwards compatibility to older browsers (like MSIE8) you'll need to use double background-image
declarations - like:
background-image: url(low-res.png); /* CSS2 */
background-image: url(high-res.png), none; /* CSS3 */
background-size: 100px 10px; /* CSS3 */
2) The -webkit-max-device-pixel-ratio media query may also help, but as the name implies it only works for webkit browsers.
Ramble:
The new generation Android and iOS devices have such varying screen DPIs that they've resorted to reporting CSS pixels rather than actual device pixels. This is both good or bad - depending on how you look at it.
It's bad because you're not guaranteed anymore the down-to-the-device-pixel control you were used to having, working with the mostly homogenous screens of yore.
On the other hand, it's good because you know your designs will never render so tiny that they can't be read/used by regular humans.
The problem with using target-densitydpi=device-dpi
is that it while it works wonders on a 7inch wide 800px screen, it will completely ruin your application on a 4inch wide 960px screen.