How to start a new line with a particular item with Flexbox?

后端 未结 3 1610
长发绾君心
长发绾君心 2020-12-12 04:58

This is a very simple exercise but I can\'t seem to find a neat way to solve it (just started learning about HTML and CSS).

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-12 05:10

    * {
      margin: 0;
      box-sizing: border-box;
    }
    
    section {
      display: flex;
      flex-wrap: wrap;
      width: 100vw;
      height: 100vh;
    }
    
    section > div {
      flex-basis: 25%;
      justify-content: space-around;
      background: rgba(0, 0, 0, 0.1);
      text-align: center;
    }
    
    section > div:last-child {
      flex-basis: 100%;
    }
    1
    2
    3
    4
    5

提交回复
热议问题