常见ie css hack

.all IE{property:value9;}
.gte IE 8{property:value;}
.lte IE 7{*property:value;}
.IE 8/9{property:value;}
.IE 9{property:value9;}
.IE 7{+property:value;}
.IE 6{_property:value;}
.not IE{property//:value;}

lte:就是Less than or equal to的简写,也就是小于或等于的意思。

lt :就是Less than的简写,也就是小于的意思。

gte:就是Greater than or equal to的简写,也就是大于或等于的意思。

gt :就是Greater than的简写,也就是大于的意思。

!  :就是不等于的意思,跟javascript里的不等于判断符相同

========================

* html selector                    /* for IE6 and below */

*+html selector                  /* for IE7 and IE5 */

*:first-child+html selector  /* for IE7 only */

html>body selector            /* for IE7+ and other standard browsers */

html>/**/ body selector   /* for not IE */

_property:value                  /* for IE6 and below */

*property:value                  /* for IE7、6、5 */

porperty:value/              /* for IE8 */

porperty:value9                /* for all IE */

===================================

1、IE6的双边距BUG.

    发生条件:如果有元素是浮动元素,则该元素与它的父元素(一般是一个容器)直接相接触(中间不能隔着其他元素)的左或右的边距就会产生双倍边距,也意味着相邻的兄弟元素不可能会产生双倍边距,只有元素与其父元素之间才有可能产生双倍边距,产生双倍边距的那边是与其父元素相接触的那边

     解决方法:给产生双倍边距的元素添加上 display:inline

2、IE6的3px间隙BUG.

    发生条件:属于兄弟关系的不浮动元素与浮动元素相邻时,会有3px的间隙,其中的不浮动元素也包括文本。

    解决办法:是给浮动元素设一个负边距,如margin-right:-3px

3、FF火狐浏览器的margin-top BUG。

        BUG描述:比如两个嵌套的div元素,里面的div元素的margin-top会跑带外层的div元素中去,如果外层的元素也有margin-top,则两者不会叠加,而是取margin-top值较大的那个。其实这个是边距叠加造成的

       解决方法:给里面的div元素加上display:inline-block属性,或设置成绝对定位,或浮动都可以

4、当绝对定位的元素不显示的设置left、right、top、bottom的值时,它会就会出现在文档流中它本来该出现的地方。这时IE7及其以下版本会把这个绝对定位元素看成是inline元素,即使显示的设置了display为block,其他标准浏览器则会认为这个元素时block元素.

=========================

参考网络资源整理

原文地址:https://www.cnblogs.com/leshao/p/4692143.html