css float浮動清除

來源:互聯網
上載者:User

標籤:class   png   eve   情況   pre   display   microsoft   log   normal   

1、標準文檔流下的div的顯示特點

現有3個div,父級div命名為:divmain,同級子div分別命名為:div-left,div-right。

當我們不使用div浮動的時候,正常文檔流(normal document)情況下,代碼及顯示效果如下所示:

 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4  5     <meta charset="UTF-8"> 6     <title>css float學習</title> 7     <style type="text/css"> 8     .divmain{ 9         margin-left: 30px;10         background-color: #FFO;11         width:400px; 12         border: 1px solid #FF0000;13     }14     .div-left, .div-right{15         width: 180px; 16         height: 100px;17         border: 1px solid #000;18     }19     </style>20 </head>21 <body>22 <!--HTML div測試-->23 <div class="divmain">24 <div class="div-left">div left浮動</div>25 <div class="div-right">div right浮動</div>26 </div>27 </body>28 </html>
View Code

 

由我們可以很明顯的看到,父級div(divmain)可以包容兩個子div(div-left,div-right),並按照正常標準文檔流的特點,區塊層級元素獨行顯示,並自上而下的特點顯示在瀏覽器上。

 

css float浮動清除

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.