Hi,
I've produced a site with both "desktop" and "phone" CSS and have used the following HTML to select the appropriate file:
This is based on the example given in the Safari Web Content Guide and it works perfectly; it uses desktop.css on desktops and tablets, and phone.css on iPhones and Android phones.
The only problem is that it doesn't validate.
It goes on to suggest using max-width instead of max-device-width. The problem with using max-width is that it causes a desktop browser to switch to phone.css when the window is resized below 768px wide. I do not want this; my phone.css is specifically designed with "taps" in mind and does not present a good experience when using a mouse.
Does anyone know whether there is a valid way of specifying "only do this on a phone", or am I stuck with using the deprecated device-width feature?
Thanks
I've produced a site with both "desktop" and "phone" CSS and have used the following HTML to select the appropriate file:
Code:
<link media="only screen and (max-device-width: 767px)" href="/Css/phone.css" type="text/css" rel="stylesheet" />
<link media="screen and (min-device-width: 768px)" href="/Css/desktop.css" type="text/css" rel="stylesheet" />
This is based on the example given in the Safari Web Content Guide and it works perfectly; it uses desktop.css on desktops and tablets, and phone.css on iPhones and Android phones.
The only problem is that it doesn't validate.
Bad value only screen and (max-device-width: 767px) for attribute media on element link: Deprecated media feature max-device-width.
It goes on to suggest using max-width instead of max-device-width. The problem with using max-width is that it causes a desktop browser to switch to phone.css when the window is resized below 768px wide. I do not want this; my phone.css is specifically designed with "taps" in mind and does not present a good experience when using a mouse.
Does anyone know whether there is a valid way of specifying "only do this on a phone", or am I stuck with using the deprecated device-width feature?
Thanks