在Web设计中,有时候我们需要将两个
<div class="wrapper">
<div class="top">
<p>This is the top section.</p>
</div>
<div class="bottom">
<p>This is the bottom section.</p>
</div>
</div> 在上面的代码中,我们使用了一个包裹器
.wrapper {
display: flex;
flex-direction: column;
justify-content: space-between;
height: 100vh;
}
.top {
background-color: #8cc63f;
height: 50%;
}
.bottom {
background-color: #b6d16c;
height: 50%;
} 我们使用了Flexbox布局,将包裹器的display属性设置为flex,让它成为一个Flexbox容器。然后,我们使用flex-direction属性将Flexbox容器的方向设置为垂直方向,并且使用justify-content属性将两个
接着,我们设置了两个
到此为止,我们已经成功地将两个