一.利用特殊符号
height:20px; /*For Firefox*/
*height:25px; /*For IE7 & IE6*/
_height:20px; /*For IE6*/
二.title方式(实质上统特殊符号)
#example { color: #333; } /* Moz */
* html #example { color: #666; } /* IE6 */
*+html #example { color: #999; } /* IE7 */
三使用IE专用的条件注释
<!--其他浏览器 -->
<link rel="stylesheet" type="text/css" href="css.css" />
<!--[if IE 7]>
<!-- 适合于IE7 -->
<link rel="stylesheet" type="text/css" href="ie7.css" />
<![endif]-->
<!--[if lte IE 6]>
<!-- 适合于IE6及一下 -->
<link rel="stylesheet" type="text/css" href="ie.css" />
<![endif]-->
四.css filter的办法
此方法太复杂,不推荐使用
五.最简洁方式(强烈推荐)
1. *: IE 7
2. _: IE 6 及IE6以前的版本
3. Firefox 不识别任何特殊符号
例子:
#example {margin-left:10px; _margin-left:-5px;*margin-left:6px;} (注意实用顺序,fx兼容一定是在最前面)
FF 下為右偏 10px
IE6及以前版本:左偏 5px
IE7: 右偏 6px