技术点:使用 display:flex;布局。
效果
html
<section class="section">
<div class="div">
<h3 class="full"><a href="/hurt">小麦病虫害</a></h3>
</div>
<div class="div">
<h3 class="full" ><a href="/mostLike_addr">最受欢迎农产品</a></h3>
</div>
<div class="div">
<h3 class="full" ><a href="/line">农业总产值预测</a></h3>
</div>
<div class="div">
<h3 class="full" ><a href="/line_product">历史农产品价格</a></h3>
</div>
</section>
css
.section {
margin-top: 5%;
height: calc(40% - 1px);
width: calc(80%);
margin-left: 3%;
display: flex;
flex-wrap: wrap;
justify-content: space-around;
/*margin-left: 5%;*/
}
.div{
width: calc(18%);
height: 20%;
margin-left: 6%;
background-color: gainsboro;
border-radius: 25px;
text-align: center;
}
.full{
margin-top: 10px;
width: 100%;
height: 100%;
}