區別不同瀏覽器,CSS hack寫法:

區別IE6FF
       background:orange;*background:blue;

 

區別IE6IE7
       background:green !important;background:blue;

 

區別IE7FF
       background:orange*background:green;

 

區別FFIE7IE6
       background:orange;*background:green !important;*background:blue;

 

注:IE都能識別*;標準瀏覽器(如FF)不能識別*;
IE6能識別*,但不能識別 !important,
IE7能識別*,也能識別!important;
FF不能識別*,但能識別!important;

 


IE6 IE7 FF
* ×
!important ×

 


另外再補充一個,下劃線"_",
IE6支持下劃線,IE7和firefox均不支持下劃線。

於是大家還可以這樣來區分IE6IE7firefox
: background:orange;*background:green;_background:blue;

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

 

safari css hack 的寫法: 在要定義樣式前面加上:body:nth-of-type(1)  如<div id="test">紅色字體</div>

safari css的寫法 :body:nth-of-type(1) #test{color:#ff0000;s}

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