ie6/7/8/ff css hack兼容

/ 0评 / 0

ff  写法: margin-top:12px!important;

ie7 写法:*margin-top:12px!important;

ie6 写法: _margin-top:12px;

ie6不能识别 * !important 但能识别 _

ie7能识别 !important 同时也能识别 *

ff能识别 !important 但不能识别 *

ie8也能识别 !important ,但不能识别 * !important; 及 _

通常顺序写法是 :ff(ie8)  ie7  ie6

以上个人见解。

不过这仅仅是一种权宜之计。真正写的好的人,是不用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支持 */
}

发表评论

您的电子邮箱地址不会被公开。

*