div+css使用!important标记区别Firefox和IE6
2007-09-24 22:16
561 查看
div+css使用!important标记区别Firefox和IE6
[使用!important标记可以区别Firefox和IE6]
Firefox支持!important标记,而IE6忽略!important标记,因此可以使用!important标记区别Firefox和IE6。<html>
<body>
<div style="color: black !important; color: white;">
firefox中显示为黑色文字,IE6中显示为白色文字
</div>
<div style="color: white !important; color: black;">
firefox中显示为白色文字,IE6中显示为黑色文字
</div>
</body>
</html>
[使用!important区分Firefox和IE6时需要放在前面]
<html><body>
<div style="color: red !important; color: blue;">
使用!important区别firefox与IE6时,要注意实现原理,Firefox识别!important标记,相当于提升了带有! important的权重,当样式设置为color: red !important; color: blue;时,Firefox认为color: red !important;的权重大于color: blue;,所以Firefox识别为color: red;。而IE6不识别!important标记,当样式设置为color: red !important; color: blue;时,IE6认为color: red !important;的权重和color: blue;的权重相同,由于color: blue;的位置靠后,所以IE6识别为color: blue;。
</div>
<div style="color: red; color: blue !important;">
如果!important设置在靠后。当样式设置为color: red; color: blue !important;时,Firefox认为color: blue !important的权重大于color: red;,所以Firefox识别为color: blue;。而IE6不认别!important标记,当样式设置为color: red; color: blue !important;时,IE6认为color: red;的权重和color: blue !important;的权重相同,由于color: blue !important;的位置靠后,所以IE6也识别为color: blue;。此时,!important就没有起到区分Firefox与IE6的作用。
</div>
</body>
</html>
[div+css关键词]
div css[div+css重要工具]
Internet Explorer Developer Toolbar, http://www.microsoft.com/downloads/details.aspx?FamilyID=e59c3964-672d-4511-bb3e-2d5e1db91038&displaylang=en[div+css的常见问题]
较验div+css格式,http://validator.w3.org/div+css的margin缩写方式
div+css的padding缩写方式
链接的:link,:visited,:hover,:active四种状态
[div+css的浏览器兼容问题]
水平居中,Firefox使用margin-left: auto; margin-right: auto; IE6 使用text-align: center;垂直居中,Firefox中使用display: table-cell; vertical-align: middle;可以实现div垂直居中,而IE6中则需要借助IE6中css的特点实现垂直居中。
!important标记,Firefox支持!important标记,IE6忽略!important标记,!important需要放在前面才能起作用
手形鼠标指针,使用cursor: pointer;
相关文章推荐
- div+css使用!important标记实现Firefox和IE6处理padding尺寸上的兼容
- div+css使用!important标记实现Firefox和IE6处理padding尺寸上的兼容
- div+css使用padding样式和!important标记实现Firefox和IE6处理带float样式的margin尺寸上的兼容
- DIV+CSS在IE6和FireFox的区别
- CSS中使用!important解决IE6 IE7 Firefox兼容性问题
- FireFox和IE浏览器对于DIV+CSS设计的区别及对策
- CSS在IE6,IE7,FIREFOX中的区别
- css+div设计时IE与Firefox的主要区别
- CSS中!important的使用 本篇文章使用最新的IE10以及firefox与chrome测试 !important优先级最高
- DIV+CSS--IE6,IE7,IE8,Firefox兼容的(转)
- css div实现的遮罩层完美兼容IE6-IE9 FireFox
- div+css 兼容ie6 ie7 ie8 ie9和FireFox Chrome等浏览器方法(原创理论)
- Div+CSS浏览器兼容问题( FireFox IE6 IE7 IE8 IE9)
- css+div设计时IE与Firefox的主要区别
- CSS在IE6,IE7,FIREFOX中的区别
- ie6,ie7,ie8 ,firefox 在css 中区别
- div+css处理firefox与IE6的水平居中效果
- 黄聪:DIV+CSS建站经验总结,不同版本IE下CSS布局bug问题(IE5、IE6、IE7、IE8、火狐Firefox兼容)
- div+css 兼容ie6 ie7 ie8 ie9和FireFox Chrome等浏览器方法
- IE6与FireFox的区别(js和css )