多栏布局

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style >
.content{
padding:0px;
margin:0px;
border:red 1px solid;
position:absolute;
top:0px;
bottom:0px;
height:100%;
width:100%;
overflow-y:scroll;
}
.top{
position:relative;
border:#ccc 1px solid;

}
.left{
height:200px;
width:300px;
background:green;
float:left;
}
.right{
height:200px;
/* width:200px;*/
margin-left:300px;
background:pink;
position:relative;
}
.middle{
position:relative;
margin-top:30px;
overflow:hidden;
border:red 1px solid;
}
.left_1{
height:200px;
width:auto;
background:pink;
margin-right:300px;
}
.right_1{
width:300px;
height:200px;
background:green;
position:absolute;
right:0px;
top:60px;
}
.left_21{
height:200px;
width:300px;
background:green;
float:left;
}
.left_22{
height:200px;
width:300px;
margin-left:300px;
background:blue;
position:absolute;
}
.right_21{
height:200px;
background:pink;
position:relative;
right:0px;
margin-left: 600px;
}
.left_31{
height: 200px;
width: 300px;
background: green;
float: left;
}
.left_32{
height: 200px;
background: pink;
margin-left: 300px;
margin-right: 300px;
}
.right_3{
height: 200px;
width: 300px;
background: green;
position: absolute;
right: 0px;
top: 60px;
}
</style>
</head>

<body>
<div class="content">

<div class="top">
<h3>左边固定右边自适应</h3>
<div class="left"></div>
<div class="right"></div>
</div>
<div class="middle">
<h3>右边固定,左边自适应</h3>
<div class="left_1"></div>
<div class="right_1"></div>
</div>
<div class="middle">
<h3>左边两个div固定大小,右边自适应</h3>
<div class="left_21"></div>
<div class="left_22"></div>
<div class="right_21"></div>
</div>
<div class="middle">
<h3>左右两个div固定大小,中间自适应</h3>
<div class="left_31"></div>
<div class="left_32"></div>
<div class="right_3"></div>
</div>
</div>
</body>
</html>

总结:多栏布局更多的适用于左侧导航栏固定的场景,比之前讲的圣杯布局写法更简单,实现的效果是一样的。

转载于:https://www.cnblogs.com/ryt103114/p/6196346.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值