1.使用<div>元素布局
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>div布局</title>
<style type="text/css">
body{
margin: 0px;
}
div#container{
width: 100%;
height: 950px;
background-color: rgba(48, 106, 89, 0.72);
}
div#heading{
width: 100%;
height: 10%;
background-color: coral;
}
div#content_menu{
width: 30%;
height: 80%;
background-color: chartreuse;
float: left;
}
div#content_body{
width: 70%;
height: 80%;
background-color: darkgreen;
float: left;
}
div#footing{
width: 100%;
height:10%;
background-color: black;
clear: left;
}
</style>
</head>
<body>
<div id="container">
<div id="heading">头部</div>
<div id="content_menu">内容菜单</div>
<div id="content_body">内容主体</div>
<div id="footing">底部</div>
</div>
</body>
</html>
运行效果如下:
2.使用<table>元素布局
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>table布局</title>
</head>
<body marginheight="0px" marginwidth="0px">
<table width="100%" height="950px" style="background-color: dimgrey">
<tr>
<td colspan="3" width="100%" height="10%" style="background-color: springgreen">这是头部</td>
</tr>
<tr>
<td width="20%" height="80%" style="background-color: aqua">左菜单
<ul>
<li>ios</li>
<li>android</li>
<li>html5</li>
</ul>
</td>
<td width="60%" height="80%" style="background-color: blueviolet"></td>
<td width="20%" height="80%" style="background-color: lightpink">右菜单</td>
</tr>
<tr>
<td width="100%" height="10%" colspan="3" style="background-color: black">这是底部</td>
</tr>
</table>
</body>
</html>
运行效果如下: