css hack 尽我所见

1.IE条件注释注:

<!--[if IE]><![endif]-->         只在IE下有效
<!--[if IE 6]><![endif]-->      只在IE6有效 7,8同理
<!--[if gt IE 6]><![endif]-->  只在IE6以上版本有效
  lte:<=  lt:<  gte:>=  gt:>  !:!=

2.选择符前缀法:

“*html” 前缀只对IE6生效  "*+html"前缀只对IE7生效
.test{width:80px;}           /*IE 6 7 8*/
*html .test{width:70px;}  /*IE6*/
*+html .test{width:60px;}/*IE7*/

缺点:不能保证IE9,10不识别*html,*+html,有向后兼容风险

3.样式属性前缀法:

.test{width:80px;*width:70px;_width:60px;}

可用于内联样式:

<div style="width:80px;*width:70px;_width:60px;"></div>

同样有向后兼容隐患

posted @ 2012-02-22 19:41  码农13  阅读(124)  评论(0编辑  收藏  举报