圣杯布局
<title>圣杯布局</title>
<style>
body{
min-width: 800px;
}
*{
padding: 0;
margin: 0;
}
.header{
height: 60px;
background-color:
}
.parent {
/* box-sizing: border-box; */
background-color:
height: 500px;
padding: 0 215px 0 115px; /*为了使
}
.left {
margin-left: -100%;
position: relative;
left: -115px;
float: left;
width: 100px;
height: 500px;
background-color:
opacity: 0.5;
}
.center {
float: left;
width: 100%; /*由于
height: 500px;
box-sizing: border-box;
/* border: 1px solid
background-color:
}
.right {
position: relative;
left: 215px;
width: 200px;
height: 500px;
margin-left: -200px; /*使
float: left;
background-color:
opacity: 0.5
}
/* .footer{
height: 60px;
clear: both;
background-color:blueviolet;
} */
</style>
<body>
<header class="header"></header>
<div class="parent">
<!--
<div class="center"></div>
<div class="left"></div>
<div class="right"></div>
</div>
<!-- <footer class="footer"></footer> -->
</body>
</html>
双飞翼布局
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.header {
height: 60px;
background-color:cyan;
}
.center {
height: 500px;
float: left;
width: 100%;
background-color: blueviolet;
}
.center_inbox{
height: 480px;
border: 1px solid
margin: 0 220px 0 120px;
}
.left {
float: left;
width: 100px;
height: 500px;
margin-left: -100%;
background-color:pink;
opacity: 0.5;
}
.right {
float: left;
width: 200px;
height: 500px;
margin-left: -200px;
background-color:deepskyblue;
opacity: 0.5;
}
.footer {
clear: both;
height: 60px;
background-color:
}
</style>
<body>
<div class="header"></div>
<div class="center">
<div class="center_inbox">中间自适应</div>
</div>
<div class="left">左列定宽</div>
<div class="right">右列定宽</div>
<div class="footer"></div>
</body>
</html>
三列自适应布局
<body>
<div class="header"></div>
<div class="center">
<div class="center_inbox">中间自适应</div>
</div>
<div class="left">左列定宽</div>
<div class="right">右列定宽</div>
<div class="footer"></div>
</body>
<style>
.header {
height: 60px;
background-color:
}
.center {
height: 500px;
float: left;
width: 100%;
background-color:
}
.center_inbox{
height: 480px;
border: 1px solid
margin: 0 220px 0 120px; /*关键!!!左右边界等于左右盒子的宽度,多出来的为盒子间隔*/
}
.left {
float: left;
width: 100px;
height: 500px;
margin-left: -100%; /*调整
background-color:
opacity: 0.5;
}
.right {
float: left;
width: 200px;
height: 500px;
margin-left: -200px; /*使right到指定的位置,值等于自身宽度*/
background-color:
opacity: 0.5;
}
.footer {
clear: both; /*注意清除浮动!!*/
height: 60px;
background-color:
}
</style>