# 圣杯布局
# float+定位
<!DOCTYPE html>
<html>
<style>
#header,
#footer {
background: rgba(29, 27, 27, 0.726);
text-align: center;
height: 60px;
line-height: 60px;
clear: both;
}
#container {
padding: 0 200px;
/* 上 右 下 左 上下值为0 左右根据左右侧盒子宽度决定 */
overflow: hidden;
}
#left,
#right,
#center {
height: 200px;
float: left;
position: relative;
}
#left {
width: 200px;
margin-left: -100%;
/* left值为盒子宽度 */
left: -200px;
background-color: aqua;
}
#right {
width: 200px;
margin-left: -200px;
/* margin-left/right值为盒子宽度 */
right: -200px;
background-color: wheat;
}
#center {
width: 100%;
background-color: tomato;
}
</style>
<body>
<div id="header">#header</div>
<div id="container">
<div id="center">#center</div>
<div id="left">#left</div>
<div id="right">#right</div>
</div>
<div id="footer">#footer</div>
</body>
</html>
# flex
<!DOCTYPE html>
<html lang="en">
<head>
<style>
.header,
.footer {
height: 50px;
background: aquamarine;
}
.center {
display: flex;
height: 400px;
}
.left,
.right {
width: 200px;
background: red;
}
.middle {
flex: 1;
background: cadetblue;
}
</style>
</head>
<body>
<div class="container">
<div class="header">header</div>
<div class="center">
<div class="left">left</div>
<div class="middle">middle</div>
<div class="right">right</div>
</div>
<div class="footer">footer</div>
</div>
</body>
</html>