css样式 一行四个均分flex排版(终极解法)

1.需求
在这里插入图片描述

<div class="bottom-tables">
        <div></div>
        <div></div>
        <div></div>
        <div></div>
</div>
<style>      
    .bottom-tables {
    
    
      width: 100%;
      margin-top: 30px;
      display: flex;
      flex-wrap: wrap;
      box-sizing: border-box;
      // overflow-y: scroll;
      > div {
    
    
        width: 22.75%;
        margin-right: 3%;
        margin-bottom: 10px;
        background: #1d274b;
        border-radius: 19px;
        box-sizing: border-box;
        height: 245px;
        &:nth-child(4n) {
    
    
          margin-right: 0;
        }
      }
    }
 </style>

猜你喜欢

转载自blog.csdn.net/weixin_44705979/article/details/132317681