- 圣杯布局
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
div{
height:200px;
}
.container{
padding:0 220px 0 320px;
}
.main{
width:100%;
float:left;
background-color: #ccc;
}
.left{
width:300px;
float:left;
margin-left: -100%;
background-color: #e00;
position: relative;
left:-320px;
}
.right{
width:200px;
float: left;
margin-left: -200px;
background-color: #00e;
position: relative;
left:220px;
}
</style>
</head>
<body>
<div class='container'>
<div class='main'>main</div>
<div class='left'>left</div>
<div class ='right'>right</div>
</div>
</body>
</html>
- 双飞翼布局
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
div {
height: 200px;
}
.main-wrap {
width: 100%;
float: left;
}
.main {
background-color: #ccc;
margin: 0 220px 0 320px;
}
.left {
width: 300px;
float: left;
margin-left: -100%;
background-color: #e00;
}
.right {
width: 200px;
float: left;
margin-left: -200px;
background-color: #00e;
}
</style>
</head>
<body>
<div class='container'>
<div class='main-wrap'>
<div class='main'>main</div>
</div>
<div class='left'>left</div>
<div class='right'>right</div>
</div>
</body>
</html>
使用flex弹性布局实现
display:flex;
flex-flow:row;
网友评论