CSS萬能閉合標籤(常用)

來源:互聯網
上載者:User

拋掉對 IE/Mac 的支援之後,新的清除浮動方法:

/* new clearfix */.clearfix:after {visibility: hidden;display: block;font-size: 0;content: " ";clear: both;height: 0;}* html .clearfix             { zoom: 1; } /* IE6 */*:first-child+html .clearfix { zoom: 1; } /* IE7 */

說明:

IE6 和 IE7 都不支援 :after 這個偽類,因此需要後面兩條來觸發IE6/7的haslayout,以清除浮動。幸運的是IE8支援 :after 偽類。因此只需要針對IE6/7的hack了。

糖伴西紅柿說:
Jeff Starr 在這裡針對IE6/7用了兩條語句來觸發haslayout。我在想作者為什麼不直接用 * 來直接對 IE6/7 同時應用 zoom:1 或者直接就寫成:

.clearfix:after {visibility: hidden;display: block;font-size: 0;content: " ";clear: both;height: 0;}.clearfix{*zoom:1;}

引自:http://www.cnblogs.com/zllwebjs/archive/2010/03/19/1689980.html
相關文章

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.