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