1區別IE6與其它瀏覽器:
background:orange; html
_background:blue;
2區別IE6與IE7:
background:green !important; 瀏覽器
background:blue; spa
3區別IE六、IE7與FF:
background:orange; firefox
*background:green; htm
4區別FF,IE7,IE6:
background:orange; get
*background:green !important; it
*background:blue; io
5區別IE與非IE瀏覽器
background:orange; import
background:green\9;/*全部IE瀏覽器都識別(IE六、IE七、IE八、IE9)*/ 方法
注:IE6/7能識別*;標準瀏覽器(如FF)不能識別*;
background-color:orange\0; /*識別ie 8/9*/
background-color:orange\9\0; /*識別ie 9*/
6 *+html 與 *html 是IE特有的標籤, 而*+html 又爲 IE7特有標籤.
#comments{ width: 120px; } /* FireFox */
*html #comments{ width: 80px;} /* ie6 fixed */
*+html #comments{ width: 60px;} /* ie7 fixed */
注意: *+html 對IE7的HACK 必須保證HTML頂部有以下聲明:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
總結 :(注:不論是什麼方法,書寫的順序都是firefox的寫在前面,IE7的寫在中間,IE6的寫在最後面) FF不能識別*,但能識別!important; IE7能識別*,也能識別!important; IE6能識別*,但不能識別 !important; IE6支持下劃線,IE7和firefox均不支持下劃線