PDA

View Full Version : 2 css Styles / iphone or mobile devices


javierrebelde
08-29-2009, 09:27 PM
HI,

i have 2 css styles one for regular computers and the other foe iphone or mobile devices but i don't know hot to make the code to switch between one and other if the connection comes from a mobile device or iphone .


any help?

i found this but i dont undestand what i have to do with that.

http://www.conditional-css.com/usage

DWcourse
08-29-2009, 10:06 PM
no personal experience but from http://www.personal.psu.edu/drs18/blogs/davidstong/2007/07/iphone_css_1.html is a start

For iPhone:

<link media=”only screen and (max-device-width: 480px)”
href=”iPhone.css” type=”text/css” rel=”stylesheet” />

For everyone else:

<link media="screen and (min-device-width: 481px)"
href="not-small-device.css" type="text/css" rel="stylesheet" />

edbr
08-31-2009, 02:04 AM
ive always used php to detect user agent then an if condition to redirect or style changer. i an sure ther is a javascript equivalent . the php function is called ismobile if any use to you
http://sourceforge.net/projects/ismobile/files/ismobile/0.1/ismobile-v0.1.zip/download

javierrebelde
08-31-2009, 03:35 PM
thanks i will try that today.