布局
2015-08-16 11:09
253 查看
一、使用<div>元素布局
头+体(左右)+尾
二、使用<table>元素布局
头+体(左右)+尾
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>div布局</title> <style type="text/css"> body{ margin: 0px; } div#container{ min-width: 100%; height: 950px; background-color: burlywood; } div#heading{ width: 100%; height: 10%; background-color: aqua; } div#content_left{ width: 30%; height: 80%; background-color: brown; /*从左到右的排序方式 必须有*/ float: left; } div#content_right{ width: 70%; height: 80%; background-color: darkorange; /*从左到右的排序方式 必须有 不然会上下排列*/ float: left; } div#footing{ width: 100%; height: 10%; background-color: forestgreen; /*上面设定了浮动,如果不清除浮动,则默认跟着做浮动 不会出现在最下面*/ clear: both; } </style> </head> <body> <div id="container"> <div id="heading">头部</div> <div id="content_left">内容菜单</div> <div id="content_right">内容主体</div> <div id="footing">底部</div> </div> </body> </html>
二、使用<table>元素布局
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>table布局</title> <style type="text/css"> body{ margin: 0px; } div#container{ min-width: 100%; height: 950px; background-color: burlywood; } div#heading{ width: 100%; height: 10%; background-color: aqua; } div#content_left{ width: 30%; height: 80%; background-color: brown; /*从左到右的排序方式 必须有*/ float: left; } div#content_right{ width: 70%; height: 80%; background-color: darkorange; /*从左到右的排序方式 必须有 不然会上下排列*/ float: left; } div#footing{ width: 100%; height: 10%; background-color: forestgreen; /*上面设定了浮动,如果不清除浮动,则默认跟着做浮动 不会出现在最下面*/ clear: both; } </style> </head> <body marginheight="0px" marginwidth="0px"> <table width="100%" height="950px" style="background-color: aliceblue"> <tr> <td colspan="2" width="100%" height="10%" style="background-color: aqua">这是头部</td> </tr> <tr> <td width="30%" height="80%" style="background-color: darkcyan">左菜单</td> <td width="70%" height="80%" style="background-color: olivedrab">右菜单</td> </tr> <tr> <td width="100%" height="10%" colspan="2" style="background-color: mediumpurple">这是底部</td> </tr> </table> </body> </html>
相关文章推荐
- hdu 5391 Zball in Tina Town (素数的判断)
- Java JVM 内部结构
- matlab基础 数据拟合
- C++基础---基本编程语句
- 安卓端实现拉出式、抽屉式、仿QQ侧滑菜单效果
- NYOJ 201 作业题
- redis源码阅读[3]
- 【大数据处理架构】3. kafka安装与使用
- hdu 5392-Infoplane in Tina Town(质因子分解求最小公倍数)
- 8586 括号匹配测试
- [Leetcode] 回文问题
- 窥探Swift之新添数据类型元组与可选值
- windows下安装redis
- Python编程习惯
- 01距离 解题报告
- QT_QAction
- 通过trait reference来保存 函数、closure 的调用入口
- fork与缓存
- Oracle基于学习3--Oracle创建用户和授权
- 记录下帮助一位网友解决的关于android子控件的onTouch或onClick和父OnTouch 冲突的问题。