<dl>
<dt>1-1. flex布局左右</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. flex布局右左</dt>
<dd class="box-1-2">
<div class="layout">
<div class="left">分类列表区域</div>
<div class="right">主要内容区域<p>这是p标签的内容</p></div>
</div>
</dd>
<dt>1-2. flex布局右左通过flex中的order属性</dt>
<dd class="box-1-3">
<div class="layout">
<div class="left">分类列表区域</div>
<div class="right">主要内容区域<p>这是p标签的内容</p></div>
</div>
</dd>
</dl>
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{
display: flex;
}
.left{background-color: pink; padding: 10px;}
.right{background-color: skyblue; padding: 10px;}
}
.box-1-1{
.left{
width: 200px;
}
.right{
flex-grow: 1;
}
}
.box-1-2{
.layout{
flex-direction: row-reverse;
}
.left{
width: 200px;
}
.right{
flex-grow: 1;
}
}
.box-1-3{
.left{
width: 200px;
order: 1;
}
.right{
flex-grow: 1;
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.