拷貝自大陸網站
http://www.xmlasp.net/n1846c40.aspx


如果在設計CSS方面,你在Firefox與IE顯示有很大問題時候,
可以好好看一下,了不起就是,為了不同核心瀏覽器都寫一份CSS囉。
不過比較擔心就是在W3C驗證部份會不會不過,哈哈,這樣就不夠
「標準」啦~~~

區別不同瀏覽器的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  FF
 *  √  √  ×
 !important  ×  √  √


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

于是大家還可以這樣來區分IE6,IE7,firefox
: background:orange;*background:green;_background:blue; 

注:不管是什么方法,書寫的順序都是firefox的寫在前面,IE7的寫在中間,IE6的寫在最后面。
arrow
arrow
    全站熱搜

    edastyle 發表在 痞客邦 留言(1) 人氣()