CSS hack:區分IE6,IE7,FireFox

 

 

方法一:
 
區別IE6FF
 background:orange; // FF
*background:blue; // IE6
 
區別IE6IE7
background:green !important; // IE7
background:blue; // IE6
 
區別IE7FF
 background:orange; // FF
*background:blue; // IE7
 
區別FFIE7IE6:     
 background:orange; // FF
*background:green !important; // IE7
*background:blue; // IE6

:IE都能識別*;標準瀏覽器(如FF)不能識別*;

IE6能識別*,但不能識別 !important,
IE7能識別*,也能識別!important;
FF不能識別*,但能識別!important;

  IE6 IE7 FF
* ×
!important ×

 

 

方法二:

利用下劃線"_",IE6支持下劃線,IE7和firefox均不支持下劃線。於是大家還可以這樣來區分IE6IE7firefox

 background:orange; // FF
*background:green; //IE7
_background:blue; //IE6

 :不管是什麼方法,書寫的順序都是firefox的寫在前面,IE7的寫在中間,IE6的寫在最後面。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章