CSS HACK

假如IE6、IE7、IE8的DIV元素的左外边距均不一致。可以作如下设置便可以解决此类问题:

div
{
     padding-left:250px; //解析到此处==>所有的IE均设置为250px
     *padding-left:50px; //解析到此处==>IE6和IE7设置为50px
     _padding-left:30px; //解析到此处==>IE6设置为30px
}

顺序不能错,因为_只有ie6能解析,*只有ie7能解析

\9      主要用于区分IE与非IE浏览器

padding-left:50px\9;

 

HACK注释法:

<!--[if IE 8]> IE8生效 <![endif]-->
<!--[if IE 7]> IE7生效 <![endif]-->
<!--[if IE 6]> IE6生效 <![endif]-->

 

posted @ 2015-09-06 09:49  tinyphp  Views(143)  Comments(0Edit  收藏  举报