职业IT人-IT人生活圈

 找回密码
 成为会员
搜索
查看: 879|回复: 2

再次总结下css的一些hack

[复制链接]
北大青鸟 发表于 2011-8-26 09:58 | 显示全部楼层 |阅读模式
  
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一模一样的了



有烟没火 发表于 2011-8-26 09:59 | 显示全部楼层
知道IE的就已经足够了,opera,chrome,safari,ie9这四个现在都几乎是一样的了,问题最多的也只是ie678,当然还少不了我们的国产浏览器,如果网页在opera这些浏览器中都有问题,那就是你的网页问题了。
我是谁 发表于 2012-3-4 23:32 | 显示全部楼层
学习了......
您需要登录后才可以回帖 登录 | 成为会员

本版积分规则

QQ|手机版|小黑屋|网站帮助|职业IT人-IT人生活圈 ( 粤ICP备12053935号-1 )|网站地图
本站文章版权归原发布者及原出处所有。内容为作者个人观点,并不代表本站赞同其观点和对其真实性负责,本站只提供参考并不构成任何投资及应用建议。本站是信息平台,网站上部分文章为转载,并不用于任何商业目的,我们已经尽可能的对作者和来源进行了通告,但是能力有限或疏忽造成漏登,请及时联系我们,我们将根据著作权人的要求立即更正或者删除有关内容。

GMT+8, 2024-3-29 22:16 , Processed in 0.142058 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表