區分IE全系列的css hack

來源:互聯網
上載者:User
/*  by  司徒正美 2011.6.1*/      #element {        background:orange;/* FF4 safari5 */      }      #element {        *background: blue;    /* IE7*/      }      #element {        -background: red;     /* IE6 */      }      #element {        background: green\0; /* IE8  opera11 */      }      :root #element { background:pink\9; }  /* IE9 */      @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {  /*IE10*/        #element { background:lightgreen;      }

<br /><!DOCTYPE html><br /><html><br /> <head><br /> <meta charset="utf-8"><br /> <title>區分IE全系列CSS hack by 司徒正美</title></p><p> <style><br /> #element {<br /> background:orange;/* FF4 safari5 */<br /> }</p><p> #element {<br /> *background: blue; /* IE7*/<br /> }<br /> #element {<br /> -background: red; /* IE6 */<br /> }</p><p> #element {<br /> background: green\0; /* IE8 opera11 */<br /> }</p><p> :root #element { background:pink\9; } /* IE9 */</p><p> </style><br /> </head></p><p> <body></p><p> <h1>區分IE全系列CSS hack by 司徒正美</h1><br /> <div id="element"><br /> 測試<br /> </div><br /> </body><br /></html></p><p>

運行代碼

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.