国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

CSS基礎(chǔ)教學(xué)之浮動

CSS浮動

  • ?float:讓元素浮動,取值:left(左浮動)、right(右浮動)

  • 浮動的元素,將向左或向右浮動,浮動到包圍元素的邊上,或上一個浮動元素的邊上為止。

  • 浮動的元素,不再佔(zhàn)空間了,而且,浮動元素的層級要高於普通元素。

  • 浮動的元素,一定是「塊元素」。不管它原來是什麼元素。

  • 如果浮動的元素,沒有指定寬度的話,浮動後它將盡可能的變窄。因此,浮動元素一般要定寬和高。

  • 一行的多個元素,要浮動一起浮動。

浮動的功能:可以實(shí)現(xiàn)將多個區(qū)塊元素並列排版。

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>php.cn</title>
    <style type="text/css">
        .box{
            width:350px;
            height:400px;
            background-color:#f0f0f0;
        }
        .box1{
             width:50px;
            height:50px;
            background-color:#ff0000;
            float:left;
        }
        .box2{
             width:50px;
            height:50px;
            background-color:#00ff00;
            float:left;
        }
        .box3{
             width:50px;
            height:50px;
            background-color:#0000ff;
            float:left;
        }
    </style>
    </head>
    <body>
        <div class="box">
            <div class="box1">php.cn</div>
            <div class="box2">php.cn</div>
            <div class="box3">php.cn</div>
        </div>
    </body>
</html>

問:如何讓包圍元素,包住浮動元素?

這時我們就需要下一節(jié)的知識了,在浮動元素的下邊,使用清除浮動操作。

?



繼續(xù)學(xué)習(xí)
||
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>php.cn</title> <style type="text/css"> .box{ width:350px; height:400px; background-color:#f0f0f0; } .box1{ width:50px; height:50px; background-color:#ff0000; float:left; } .box2{ width:50px; height:50px; background-color:#00ff00; float:left; } .box3{ width:50px; height:50px; background-color:#0000ff; float:left; } </style> </head> <body> <div class="box"> <div class="box1">php.cn</div> <div class="box2">php.cn</div> <div class="box3">php.cn</div> </div> </body> </html>
提交重置程式碼