基本思路:
-
和2列布局很相似
-
左右2列采用浮动+宽度
-
中间区域实际是用margin挤压出来的
-
DOM顺序不能写乱,必须先写左右再写中间
HTML结构
<div class="left">左侧</div>
<div class="right">右侧</div>
<div class="main">主体</div>
CSS样式
<style>
.left{
width: 200px;
height: 600px;
background-color: #008B8B;
float: left;
}
.right{
width: 200px;
height: 600px;
background-color: #FFFF00;
float: right;
}
.main{
height: 600px;
margin-left: 200px;
margin-right: 200px;
background-color: #4169E1;
}
</style>
发表评论