css优先级经验浅谈
DIV+CSS 2011/10/8 16:40:09 点击:不统计
1.!important
a.遵照 important 的本意使用 !important不要将 !important 当做 hack 来使用
b.慎用,只在确定要将优先级提至最高时才用
2.hack
{
color : #000 ;
color : #f00\9 ; /* 所有IE */
color : /*\**/#0f0\9 ; /* IE8 *
*color : #00f ; /* IE6/7 */
_color : #ff0 ; /* IE6 */
}
例如:
ie7下的margin-left为2px,不推荐:
.ClassName{margin:0;}
*+html .ClassName{margin-left:2px;}
推荐:
.ClassName{
margin:0;
*margin-left:2px;
_margin-left:0;
}
·上一篇:b和Strong以及i和em的区别 >> ·下一篇:text-decoration详解 >>