區別不同瀏覽器CCS Hack寫法

2021-04-18 16:54:37 字數 752 閱讀 7015

在當前ie6 ie7 fifefox三分天下的情況下,瀏覽器相容性問題成為網頁設計者需要考慮的問題.    

區別不同瀏覽器的css hack寫法: 

區別ie6與ff:         

background:orange;*background:blue; 

區別ie6與ie7:         

background:green !important;background:blue; 

區別ie7與ff:         background:orange; *background:green; 

區別ff,ie7,ie6:         

background:orange;*background:green !important;*background:blue; 

注:ie都能識別*;標準瀏覽器(如ff)不能識別*; ie6能識別*,但不能識別 !important,  ie7能識別*,也能識別!important;  ff不能識別*,但能識別!important;                               

另外再補充乙個,下劃線"_",  ie6支援下劃線,ie7和firefox均不支援下劃線。  於是大家還可以這樣來區分ie6,ie7,firefox  : background:orange;*background:green;_background:blue;  

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

根據不同瀏覽器寫不同css

最近幾天幫朋友弄了個簡單的生日頁面放在我的github部落格上,就有了不同瀏覽器可能發生介面的錯亂,如何解決?當然,作為乙個小白,我的思路是通過js判斷瀏覽器型別,再用jquery變換相應的樣式。事實證明是可以的。參考這裡只是進行最簡單的判別 例子 function return false if ...

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

區別 ie6 與 ff background orange background blue 區別 ie6 與 ie7 background green important background blue 區別 ie7 與 ff background orange background green 區...

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

區別 ie6與 ff background orange background blue 區別 ie6與 ie7 background green important background blue 區別 ie7與 ff background orange background green 區別 f...