thinking

          one platform thousands thinking

          CSS hack:區(qū)分IE6,IE7,firefox

          CSS hack:區(qū)分IE6,IE7,firefox

          區(qū)別不同瀏覽器,CSS hack寫法:


          區(qū)別IE6FF
                 background:orange;*background:blue;

          區(qū)別IE6IE7
                 background:green !important;background:blue;

          區(qū)別IE7FF
                 background:orange*background:green;

          區(qū)別FFIE7IE6
                 background:orange;*background:green !important;*background:blue;

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


          IE6 IE7 FF
          * ×
          !important ×

          _ × ×

          #
          × ×


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

          于是大家還可以這樣來區(qū)分IE6IE7firefox
          : background:orange;*background:green;_background:blue;

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




          相關(guān):

          posted on 2010-02-10 16:14 lau 閱讀(437) 評論(2)  編輯  收藏 所屬分類: Web

          Feedback

          # re: CSS hack:區(qū)分IE6,IE7,firefox 2011-01-31 14:05 lau

          *對IE8不起作用  回復(fù)  更多評論   

          # re: CSS hack:區(qū)分IE6,IE7,firefox 2011-02-12 17:30 lau

          {

          background:orange; /*for all (包括FF)*/

          background:red\0; /*for ie8*/

          *background:green; /*for ie7,ie6*/

          _background:blue; /*for ie6 ,注意,這個會重寫前面*background的樣式*/

          }
            回復(fù)  更多評論   

          主站蜘蛛池模板: 阆中市| 广平县| 佛冈县| 海口市| 白山市| 南陵县| 当阳市| 砚山县| 册亨县| 项城市| 阳西县| 白城市| 科技| 中宁县| 琼海市| 怀远县| 酒泉市| 班戈县| 福清市| 道真| 揭东县| 长白| 宁波市| 英吉沙县| 宜州市| 定州市| 寿光市| 弥渡县| 滨州市| 九寨沟县| 门头沟区| 高要市| 浪卡子县| 渭南市| 堆龙德庆县| 普兰店市| 蓬莱市| 嵊州市| 牙克石市| 梅河口市| 新巴尔虎右旗|