padding
1.<div style="position:absolute;top:0px;left:0px;padding-top:50px;padding-left:50px;width:100px;height:100px;background:#000;color:#fff;"> test </div>
以上的代码在IE中和firefox会有不同的效果.最主要原因是firefox解释padding-top与IE的效果不同
fixfox的对DIV总高度是padding-top+height的,而IE中,padding-top是包含在height中的,
要解决这一个矛盾,可以利用!important
1.<div style="padding-top:5px;height:10px !important;height:15px;width:200px;background-color:#ffeeee"> test </div>
上面定义了两个height, 其中一个后面加了!important , IE将会忽略这个属性,而使用后面的height:15px;
而firefox却不会忽略这个属性, 直接使用height:10px;
当然也可以使用
1.<div style="padding-top:5px;height:10px;*height:15px;width:200px;background-color:#ffeeee"> test </div>
*height只会被IE6/IE7解析,而FF不会解析*height
Ps:测试后补充说明一点,在IETest中测试IE6的padding-top和FF的解析方式一样,
所以如果使用*height的话还需要添加_height=10px来完善IE6的现实效果,
这样就可以很巧妙的解决这个问题
1.<div style="position:absolute;top:0px;left:0px;padding-top:50px;padding-left:50px;width:100px;height:100px;background:#000;color:#fff;"> test </div>
以上的代码在IE中和firefox会有不同的效果.最主要原因是firefox解释padding-top与IE的效果不同
fixfox的对DIV总高度是padding-top+height的,而IE中,padding-top是包含在height中的,
要解决这一个矛盾,可以利用!important
1.<div style="padding-top:5px;height:10px !important;height:15px;width:200px;background-color:#ffeeee"> test </div>
上面定义了两个height, 其中一个后面加了!important , IE将会忽略这个属性,而使用后面的height:15px;
而firefox却不会忽略这个属性, 直接使用height:10px;
当然也可以使用
1.<div style="padding-top:5px;height:10px;*height:15px;width:200px;background-color:#ffeeee"> test </div>
*height只会被IE6/IE7解析,而FF不会解析*height
Ps:测试后补充说明一点,在IETest中测试IE6的padding-top和FF的解析方式一样,
所以如果使用*height的话还需要添加_height=10px来完善IE6的现实效果,
这样就可以很巧妙的解决这个问题