左右侧固定,中间自适应布局和 左侧固定,右侧自适应布局

一、左右侧固定,中间自适应布局

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
.clearfix:after{
content: "";
display: block;
clear: both;
}
.clearfix{
zoom: 1;
}
.left{
position: absolute;
top:0px;
left: 0px;
width:200px;
height: 1000px;
background-color: #1D71B6;
}
.right{
position: absolute;
top:0px;
right: 0px;
width:300px;
height: 1000px;
background-color: #000000;
}
.main{

margin:0 310px 0 210px;
height: 1000px;
background-color: #BBBBBB;

}
</style>
</head>
<body>
<div id="contain" class="clearfix">
<div class="left">

</div>
<div class="main">

</div>
<div class="right">

</div>
</div>
</body>
</html>

二。 左侧固定,右侧自适应布局

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<style type="text/css">
.left{
float: left; /*或者是 position: absolute;*/
width:50px;
height: 80px;
background: #BBBBBB;
}
.main{
margin-left:50px;
height: 80px;
background-color: #1D71B6;
}

</style>
<body>
<div id="contain">
<div class="left">

</div>
<div class="main">

</div>
</div>
</body>
</html>

posted @ 2016-12-02 14:34  不再犯错  阅读(269)  评论(0编辑  收藏  举报