ie hack

其实总结起来就这几句话  

#test{
color:red;
color:red !important;/ Firefox、IE7支持 */
_color:red; / IE6支持 */
*color:red; / IE6、IE7支持 */
*+color:red; / IE7支持 */
color:red\9; / IE6、IE7、IE8支持 */
color:red\0; / IE8支持 */
}

 
 另外

1、如果你的页面对IE7兼容没有问题,又不想大量修改现有代码,同时又能在IE8中正常使用,微软声称,开发商仅需要在目前兼容IE7的网站上添加一行代码即可解决问题,此代码如下:
<meta http-equiv=”x-ua-compatible” content=”ie=7″ />

2、body:nth-of-type(1) 如果这样写,表示全局查找body,将会对应第一个<body>。

3、还有其他写法,比如:
*html #test{}或者 *+html #test{}

4、*+html 对IE7的hack 必须保证HTML顶部有如下声明:

http://www.w3.org/TR/html4/loose.dtd

5、顺序:Firefox、IE8、IE7、IE6依次排列。
posted @ 2016-11-14 13:56  编程未来  阅读(278)  评论(0编辑  收藏  举报