css3-盒子模型的應用

根據一個網頁的設計,來仿照網頁使用盒子製作一個類似的板塊結構:
大致分爲三部分:
網頁上面的頭部: top
網頁中間部分的內容: body
網頁下部的頁腳:footing

其中body分爲三部分
footing分爲兩部分

實例代碼如下:
(div標籤的class使用點語法 .XXX{})

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Box模型的應用</title>
    <link href="style.css" type="text/css" rel="stylesheet">
</head>
<body>
    <div class="top">
        <div class="top_content"></div>
        </div>
    <div class="body">
            <div class="body_image"></div>
            <div class="body_content">
                <div class="body_notification"></div>
            </div>
        </div>
    <div class="footing">
        <div class="footing_content"></div>
        <div class="footing_subnav"></div>
    </div>
</body>
</html>

CSS文件:style.css中內容:
*{
/*用來設定全局的屬性*/
    margin: 0px;
    padding:0px;
}
.top{
    width:100%;
    height:50px;
    background-color: black;

}
.top_content{
    width: 75%;
    height: 50px;
    margin: 0px auto;
    background-color: blue;
}
.body{
    margin: 20px auto;
    width:75%;
    height: 1500px;
    background-color: cyan;
}
.body_image{
    width:100%;
    height: 400px;
    background-color: darkolivegreen;
}
.body_content{
    width:100%;
    height: 1100px;
    background-color: blueviolet;
}
.body_notification{
    width:100%;
    height: 50px;
    background-color: gray;
}
.footing{
    width:75%;
    height: 400px;
    background-color: orange;
    margin:10px auto;
}
.footing_content{
    width:100%;
    height:330px;
    background-color: gray;
}
.footing_subnav{
    width: 100%;
    height: 70px;
    background-color: black;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章