一列布局:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
body{
margin: 0;
padding: 0;
}
.top{
width: 800px;
height: 100px;
background: red;
margin: 0 auto;
}
.main{
width: 800px;
height: 400px;
background:blue;
margin: 0 auto;
}
.footer{
width:800px;
height: 100px;
background: green;
margin:0 auto;
}
</style>
</head>
<body>
<div class="top"></div>
<div class="main"></div>
<div class="footer"></div>
</body>
</html>两列布局:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
body{
margin: 0;
padding: 0;
}
.main{
width:800px;
margin:0 auto;
}
.left{
width: 20%;
height: 500px;
float: left;
background: red;
}
.right{
width: 80%;
height: 500px;
float: right;
background: blue;
}
</style>
</head>
<body>
<div class="main">
<div class="left"></div>
<div class="right"></div>
</div>
</body>
</html>三列布局:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
body{
margin: 0;
padding: 0;
}
.main{
width:800px;
margin:0 auto;
}
.left{
width: 33.33%;
height: 500px;
float: left;
background: red;
}
.medium{
width: 33.33%;
height: 500px;
float: left;
background: green;
}
.right{
width: 33.33%;
height: 500px;
float: right;
background: blue;
}
</style>
</head>
<body>
<div class="main">
<div class="left"></div>
<div class="medium"></div>
<div class="right"></div>
</div>
</body>
</html>混合布局:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
body{
margin:0;
padding:0;
}
.top{
width:800px;
height: 100px;
background:red;
margin:0 auto;
}
.main{
width: 800px;
height: 600px;
margin: 0 auto;
}
.left{
width: 200px;
height: 600px;
background: orange;
float: left;
}
.right{
width: 600px;
height: 600px;
float: right;
}
.sub_l{
width:400px;
height: 600px;
background: black;
float: left;
}
.sub_r{
width: 200px;
height: 600px;
background: purple;
float: right;
}
.footer{
width: 800px;
height: 100px;
background: #900;
margin: 0 auto;
}
</style>
</head>
<body>
<div class=top></div>
<div class="main">
<div class="left"></div>
<div class="right">
<div class="sub_l"></div>
<div class="sub_r"></div>
</div>
</div>
<div class="footer"></div>
</body>
</html>
271



被折叠的 条评论
为什么被折叠?



