本文主要包含CSS3,Media,Queries等相关知识,冰点  希望在学习及工作中可以帮助到您
  一、Media Queries 支持的属性

二、关键字
and - 结合多个媒体查询 not - 排除某种制定的媒体类型 only - 用来定某种特定的媒体类型
三、引用样式示例
- <link rel="stylesheet" media="all" href="style.css" />
 - <link rel="stylesheet" media="screen and (min-width:980px)" href="desktop.css" />
 - <link rel="stylesheet" media="screen and (min-width:768px) and (max-width:980px)" href="pad.css" />
 - <link rel="stylesheet" media="screen and (min-width:480) and (max-width: 768px)" href="phone.css" />
 - <link rel="stylesheet" media="screen and (max-width:320px)" href="small.css" />
 
四、内联样式示例
- @media screen and (min-width: 980px) {
 - //css code
 - }
 - @screen and (min-width:768px) and (max-width:980px) {
 - //css code
 - }
 - @screen and (min-width:480) and (max-width: 768px) {
 - //css code
 - }
 - @screen and (max-width:320px) {
 - //css code
 - }
 - @media screen and (max-device-width: 480px) {
 - //max-device-width等于480px
 - }
 - @media screen and (device-aspect-ratio: 16/9), screen and (device-aspect-ratio: 16/10) {
 - //设备宽高比
 - }
 - @media all and (orientation:portrait) {
 - //竖屏
 - }
 - @media all and (orientation:landscape) {
 - //横屏
 - }
 
五、I8的兼容性问题解决
问题根源:
在项目的CSS文件中采用了media这东东来根据视窗的大小自动调整布局,但是,但是IE8及以下版本浏览器不支持CSS3 media queries,也就是@media screen and (max-width: 900px) 里面的css代码没有执行,
- @media screen and (max-width: 900px) {
 - ...
 - }
 
这如何是好啊,网上倒是有不少人提出解决方法,最简单的方法就是:
IE8和之前的浏览器不支持CSS3 media queries,你可以在页面中添加css3-mediaqueries.js来解决这个问题。
- <!--[if lt IE 9]>
 - <script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
 - <![endif]-->
 

