Wednesday, 6 April 2011

Autoscale websites for mobile devices

A handy little single line of html that I've been playing with today.  

This code means you can automatically scale the "viewport" visible window size of your website for whatever device is viewing it. No more tiny site in the middle of an empty screen.


Oooh - it's like it's 1998! 


Stick this in the head section


< meta name="viewport" content="width=device-width" / >


You can even set it so they can't zoom in or out by switching user-scalable off..


< meta name="viewport" content="user-scalable=no, width=device-width" / >