根据屏幕的分辨率不同 ,加载不同的样式
<link rel="stylesheet" type="text/css" media="screen and(max-width:计
算机屏幕)" href="link.css">
样式表内:
@media screen and(max-width:600px){
div{
color:red;
}
}
特殊设备检测
1.
Phone4
<link rel="stylesheet" media="only screen and (-webkit-min-device-pixel-ratio: 2)"
type="text/css" href="iphone4.css" />
2.
iPad
<link rel="stylesheet" media="all and (orientation:portrait)" href="portrait.css"
type="text/css" />
<link rel="stylesheet" media="all and (orientation:landscape)" href="landscape.css"
type="text/css" />
3.
android
/
*
240px
的宽度
*
/
<link rel="stylesheet" media="only screen and (max-device-width:240px)"
href="android240.css" type="text/css" />
/
*
360px
的宽度
*
/
<link rel="stylesheet" media="only screen and (min-device-width:241px) and (max-device-
width:360px)" href="android360.css" type="text/css" />
/
*
480px
的宽度
*
/
<link rel="stylesheet" media="only screen and (min-device-width:361px) and (max-device-
width:480px)" href="android480.css" type="text/css" >