布局有很多种,下面是最简单的一种,看图:
固定宽度布局
绝对定位法
比较麻烦, 就不说了
浮动法
一般都是使用浮动法
储存代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type = "text/css">
div{
border:red 1px solid;
margin:20px auto 20px auto;
padding: 10px 10px 10px 10px ;
}
#head,#middle,#foot{
width :900px;
text-align: center;
}
#middle{
border:0px;
position:relative;
height :500px;
}
#left{
position:absolute;
width:600px;
flaot:left;
height:400px;
}
#right{
height:200px;
margin-left:700px;
flaot:right;
}
</style>
</head>
<body>
<div id = "head">头部</div>
<div id = "middle">中间
<div id = "left">左边</div>
<div id = "right">右边</div>
</div>
<div id = "foot">尾部</div>
</body>
</html>
变框布局
就是使用百分比值