`
lmh2072005
  • 浏览: 111579 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

再次总结下css的一些hack

阅读更多

 

color:red; /* 所有浏览器都支持 */

color:red !important;/* 除IE6外 */

_color:red; /* IE6支持 */

*color:red; /* IE6、IE7支持 */

+color:red;/*IE7支持*/

*+color:red; /* IE7支持 */

color:red\9; /* IE6、IE7、IE8、IE9支持 */

color:red\0; /* IE8、IE9支持 */

color:red\9\0;/*IE9支持*/

 

/* webkit and opera */

 @media all and (min-width: 0px){ div{color:red;} }

 

/* webkit */

 @media screen and (-webkit-min-device-pixel-ratio:0){ div{color:red;} }

 

/* opera */

 @media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-

 

ratio:0) { div{color:red;} }

 

/* firefox * /

 @-moz-document url-prefix(){ div{color:red;}} /* all firefox */

 

 html>/**/body div, x:-moz-any-link, x:default {color:red;} /* newest firefox */

}

 

body:nth-of-type(1) p{color:red;} /* Chrome、Safari支持 */

 

<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->

<!--[if IE 7 ]> <html class="ie7"> <![endif]-->

<!--[if IE 8 ]> <html class="ie8"> <![endif]-->

<!--[if IE 9 ]> <html class="ie9"> <![endif]-->

<!--[if (gt IE 9)|!(IE)]><!--> <html> <!--<![endif]-->

<!–[if IE 7]> = 等于 IE7

 

<!–[if lt IE 8]> = 小于 IE8(就是 IE7 或以下了啦)

 

<!–[if gte IE 8]> = 大于或等于 IE8 

 

<meta http-equiv="x-ua-compatible" content="ie=7" />

把这段代码放到<head>里面,在ie8里面的页面解析起来就跟ie7一模一样的了

 

 

分享到:
评论
1 楼 vimest 2011-06-30  
知道IE的就已经足够了,opera,chrome,safari,ie9这四个现在都几乎是一样的了,问题最多的也只是ie678,当然还少不了我们的国产浏览器,如果网页在opera这些浏览器中都有问题,那就是你的网页问题了。

相关推荐

Global site tag (gtag.js) - Google Analytics