css hack總結

來源:互聯網
上載者:User

很短很短。。但是很重要很重要。

瀏覽器優先順序別:   FF < IE7 < IE6 ,CSS hack書寫順序一般為FF IE7 IE6

以: " #demo" 的樣式為例;   

#demo {width:100px; height:100px;border:1px blue solid \0}/*被FIREFOX,IE6,IE7執行.*/

* html #demo {width:100px; height:150px;border:3px green dotted }/*會被IE6執行,之前的定義會被後來的覆蓋,所以#demo的寬度在IE6就為120px; */

*+html #demo {width:100px; height:300px;border:1px red solid \9} /*會被IE7執行*/ "\0"IE8識別,IE6、IE7不能,"\0""\9"可以區別所有IE和FireFox.

---------------

所以最後,#demo的高度和邊框在三個瀏覽器的解釋為:

FF和Google:100px; 沒有邊框

ie6:150px;綠色,3像素的虛線邊框

ie7:330px;紅色,1像素的實線邊框

ie8和ie9:100px;藍色,1像素的實線邊框

相關文章

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.