You will need to use more sophisticated multimedia queries, such as those that target screen size
So, something more like
<link rel="stylesheet" href="/stylesheets/homedark.css" type="text/css" media="screen and (max-device-width: 480px)">
In your stylesheet it will be something like this
@media only screen and (max-device-width: 480px) {
http://www.w3.org/TR/css3-mediaqueries/
Discovering a device with simple JS might be useful:
if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i)){ // link to stylesheet }
Better still is to use some kind of combo ... media queries and device / function discovery.
This is a good review: http://www.csskarma.com/presentations/cssla/slides/mobile_media_touch.pdf (WARNING: pdf file)
Jason gennaro
source share