Skip to main content

Float-双飞翼布局

双飞翼布局是一种网页布局模式,用于实现一个三列布局。

即中间自适应,侧边固定宽度。

<!DOCTYPE html>
<html lang="en">
<head>
<title>双飞翼布局</title>
<style>
*{
margin: 0;
padding: 0;
}
.main{
min-width: 600px;
overflow: hidden;
}
.center-wrapper{
/* 关键代码 */
float: left;
width: 100%;
height: 600px;

background:rgb(89, 108, 197);
}
.center{
/* 关键代码 */
margin: 0 200px;
height: 100%;

text-align: center;
background:rgb(211, 70, 70);
}
.left,.right{
/* 关键代码 */
float: left;
width: 200px;
height: 400px;

background: yellowgreen;
text-align: center;
}
.left{
/* 关键代码 */
margin-left: -100%;
}
.right{
/* 关键代码 */
margin-left: -200px;
}
/* 三列等高 */
/* .center-wrapper,.left,.right{
padding-bottom: 10000px;
margin-bottom: -10000px;
} */
</style>
</head>
<body>
<div class="main">
<div class="center-wrapper">
<div class="center">center</div>
</div>
<div class="left">left</div>
<div class="right">right</div>
</div>
</body>
</html>