垂直分散对齐,针对竖向导航等情况
核心知识点: display: flex; flex-direction align-items justify-content
html代码:
<div class="content-left-nav">
<div class="active-yscy-left">能源工业</div>
<div class="">石油化工</div>
<div class="">有色冶金</div>
<div class="">装备制造</div>
<div class="">中医中药</div>
<div class="">文旅康养</div>
<div class="">通道物流</div>
<div class="">数据信息</div>
<div class="">现代农牧</div>
<div class="">基础建设</div>
</div>
css代码实现:
.content-left-nav{
font-size: 20px;
letter-spacing: 3px;
padding: 50px 0 50px 50px;
height: calc(100% - 100px);
/*垂直分散对齐关键代码*/
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-around;
}
效果展示: