關於IE6下的CSS多類選擇符

來源:互聯網
上載者:User
  多類選擇符的寫法。例如:

  #my.c1.c2 { color:red;}
  .c1.c2 { color:red;}

  以上寫法在IE7+/FF/Opera/Safari 等瀏覽器都支援。

  但在IE6中,後一個類名會覆蓋前一個類名,也就是說,上例被IE6理解為:

  #my.c2 { color:red;}
  .c2 { color:red;}

  同理:

  #my.c1.c2.c3 { color:red;}
  IE6理解為 #my.c3 {color:red;}
  .c1.c2.c3 { color:red;}
  IE6理解為 .c3 { color:red; }

  所以開發中用多類來組合實現css效果的時候,注意IE6的這個問題。最好的方法就是,不要用類組合的形式。

相關文章

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.