How can I show three columns per row?

后端 未结 3 1278
醉酒成梦
醉酒成梦 2020-12-08 12:29

I have been trying to show three columns per row. Is it possible using flexbox?

My current CSS is something like this:

.mainDiv {
    display: flex;
         


        
3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-08 13:21

    Try this one using Grid Layout:

    .grid-container {
      display: grid;
      grid-template-columns: auto auto auto;
      padding: 10px;
    }
    .grid-item {
      background-color: rgba(255, 255, 255, 0.8);
      border: 1px solid rgba(0, 0, 0, 0.8);
      padding: 20px;
      font-size: 30px;
      text-align: center;
    }
    1
    2
    3
    4
    5
    6
    7
    8
    9

提交回复
热议问题