CSS HACK最佳應用方式

來源:互聯網
上載者:User

 對於IE6

background-color:blue;
_background-color:red;

如果IE7,IE6同時有問題
以下2選一:

background-color:blue;
*background-color:red;

background-color:blue;
+background-color:red;

如果只有IE7 

 background-color:blue;
 *background-color:red;
 _background-color:blue;/*還原IE6*/

對於IE8

background-color:blue;
background-color:red\9;/*用作於IE6,IE7,IE8,IE9*/
*background-color:blue;/*還原IE6、7*/
background-color:blue\9\0;/*還原IE9*/

對於IE9 

background-color:blue;
background-color:red\9\0;/*作用於IE9*/
_background-color:blue;/*IE6無法識別,所以要恢複IE6~*/

對於整個IE

background-color:blue;
background-color:red\9;

!important

用於所有瀏覽器--不能算做是hack了 加上!important 可以完全無視css優先順序了

相關文章

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.