對於IE7、FF、OP清除浮動的最優方法第1/2頁_經驗交流

來源:互聯網
上載者:User
在CSS森林群裡討論一個margin的問題中無意間發現overflow也可以用來清除浮動,嘿嘿,這個方法不單使用簡單,而且FF、OP、IE7都支援,從此可以告別那又長相容性又差的FF清浮動的方法了。

方法真的很簡單,只要為需要清浮動的標籤加上overflow這個屬性。
css代碼

複製代碼 代碼如下:


ul{
list-style:none;
height:auto;
margin:0;p
adding:0;
background-color:#436973;
}
li{
float:left;
width:80px;
height:80px;
background-color:#83B1DF;
}
.demo{
clear:both;
border:1px solid #FF00FF;
margin-bottom:5px;
}
.overflow{
overflow:auto;
zoom:1;
background-color:#43FF73;
}
ul{
list-style:none;
height:auto;
margin:0;
padding:0;
background-color:#436973;
}
li{
float:left;
width:80px;
height:80px;
background-color:#83B1DF;
}
.demo{
clear:both;
border:1px solid #FF00FF;
margin-bottom:5px;
}
.overflow{
overflow:auto;
zoom:1;
background-color:#43FF73;
}


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.