min-height对ie6, 7, 8及ff的兼容
#element { min-height:100px; height:auto!important; height:100px;}
ie6不支持min-height, 实际上只要对ie6设置height:100px,便能实现min-height:100px的效果。
但height:auto!important和height:100px调换顺序,则ie6失去min-height效果,变为auto。
若只有min-height:100px和height:auto!important,则不论顺序如何,除ie6为auto的效果,其他均为min-height效果。
若只有min-height:100px和height:100px,则不论顺序如何,除ie6有min-height的效果,其他均为height:100px。
所以,对ie7,8,ff来说,优先级顺序为height:固定值>min-height>height:auto
--------------------------------------------------
有网友测试,认为写在同一选择器中的!important不被IE6支持,而分开则支持
比如:
#element { background:green!important; }
#element { background:red;}
则ie6支持!important
而这样:
#element { background:green!important; background:red;}
则ie6不支持!important。
其实对后一种情况,改写成这样#element { background:red; background:green!important; },结果还是green起作用,所以对这种情况,ie6可能忽略了!important这几个字符而已,就像上面height:auto!important和height:100px调换顺序一样。
注:以上测试,ie6,8为ietester模拟。
ie6不支持min-height, 实际上只要对ie6设置height:100px,便能实现min-height:100px的效果。
但height:auto!important和height:100px调换顺序,则ie6失去min-height效果,变为auto。
若只有min-height:100px和height:auto!important,则不论顺序如何,除ie6为auto的效果,其他均为min-height效果。
若只有min-height:100px和height:100px,则不论顺序如何,除ie6有min-height的效果,其他均为height:100px。
所以,对ie7,8,ff来说,优先级顺序为height:固定值>min-height>height:auto
--------------------------------------------------
有网友测试,认为写在同一选择器中的!important不被IE6支持,而分开则支持
比如:
#element { background:green!important; }
#element { background:red;}
则ie6支持!important
而这样:
#element { background:green!important; background:red;}
则ie6不支持!important。
其实对后一种情况,改写成这样#element { background:red; background:green!important; },结果还是green起作用,所以对这种情况,ie6可能忽略了!important这几个字符而已,就像上面height:auto!important和height:100px调换顺序一样。
注:以上测试,ie6,8为ietester模拟。