<dl>
<dt>1-1. 绝对定位相对定位实现两列布局</dt>
<dd class="box-1-1">
<div class="layout">
<div class="left">分类列表区域</div>
<div class="right">主要内容区域<p>这是p标签的内容</p></div>
</div>
</dd>
<dt>1-2. 绝对定位相对定位实现两列布局</dt>
<dd class="box-1-2">
<div class="layout">
<div class="left">分类列表区域</div>
<div class="right">主要内容区域<p>这是p标签的内容</p></div>
</div>
</dd>
dl{
padding: 0;
margin: 10px;
dt{
margin-top: 10px;
font-size: 20px;
color: #fff;
background-color: #00c;
height: 50px;
line-height: 50px;
padding: 0 10px;
}
dd{
border: 1px solid #ccc;
margin: 0;
height: 200px;
}
.layout{
position: relative;
}
.left{background-color: pink; padding: 10px;}
.right{background-color: skyblue; padding: 10px;}
}
.box-1-1{
.left{
width: 200px;
position: absolute;
left:0;
top: 0;
bottom: 0;
}
.right{
margin-left: 220px;
}
}
.box-1-2{
.left{
width: 200px;
position: absolute;
right: 0;
top: 0;
bottom: 0;
}
.right{
margin-right: 220px;
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.