DIV+CSS上中下布局案例


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>上中下DIV+CSS布局案例</title>
<style type="text/css">
#container{
background-color: darkgray;
text-align: center;
width: 800px;
height: 600px;
}
#top{
background-color: antiquewhite;
width: 780px;
height: 100px;
}
#main{
background-color: #00FF00;
width: 780px;
height: 400px;
}
#bottom{
background-color: aqua;
width: 780px;
height: 100px;
}
</style>
</head>
<body>
<!--需要兼容客戶屏幕寬度,布局應該使用固定尺寸-->
<!--p,h,div屬於塊狀元素,前后會自動換行-->
<!--div會自動占據整個父容器的寬度-->
<center>
<div id="container">
<center>
<div id="top">TOP</div>
<div id="main">MAIN</div>
<div id="bottom">BOTTOM</div>
</center>
</div>
</center>
</body>
</html>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM