CSS中一些兼容问题

    1.img图片底部有一小段空白(加个边框看看就知道了)

            解决:①display:block;

                       ②vertical-align:top/middle/bottom(不是baseline就行)

    2.IE6,float方向与margin方向一致时,margin会双倍显示

            解决:_display:inline;

    3.IE6,一些块级元素的高度不能低于18px

            解决:①font-size:0;(不推荐)

                       ②overflow:hidden;

    4.表单元素行高不一致

            解决:float:left;

    5.各个浏览器的按钮不一样

            解决:①用a标签代替

                       ②写样式(记得去掉边框)

                       ③用图片代替

    6.IE6,50%+50%>100%(两个宽50%的浮动元素)

            解决:给右边元素添加clear:right;

    7.cursor小手

            解决:统一用cursor:pointer;(不用cursor:hand)

    8.透明问题

            解决:IE:filter:alpha(opacity = 100);  (1~100)

                       其他:opcity:1;  (0~1)

                       注意:透明度是可以继承的

    9.下滑线

            IE6认识  例如_background-color:red;

            所以可以这样写:background-color:green;_background-color:red;(不认识“_”的会忽略,认识的会覆盖前面的)

    10.!important

            IE6不认识

    11.*

            IE6、IE7认识  例如*color:red;

    12.\9

             IE6/IE7/IE8/IE9/IE10都生效

    13.\0

            IE8/IE9/IE10都生效

    14.\9\0

            只对IE9/IE10生效

下面来源:https://blog.csdn.net/budapest/article/details/52241458

<!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]-->
<!--[if IE]> 所有的IE可识别 <![endif]-->
<!--[if IE 6]> 仅IE6可识别 <![endif]-->
<!--[if lt IE 6]> IE6以及IE6以下版本可识别 <![endif]-->
<!--[if gte IE 6]> IE6以及IE6以上版本可识别 <![endif]-->
<!--[if IE 7]> 仅IE7可识别 <![endif]-->
<!--[if lt IE 7]> IE7以及IE7以下版本可识别 <![endif]-->
<!--[if gte IE 7]> IE7以及IE7以上版本可识别 <![endif]-->
<!--[if IE 8]> 仅IE8可识别 <![endif]-->
<!--[if IE 9]> 仅IE9可识别 <![endif]-->

猜你喜欢

转载自blog.csdn.net/Yi_xuan_sky/article/details/81666959