微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐