How can I show three columns per row?

后端 未结 3 1285
醉酒成梦
醉酒成梦 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:07

    This may be what you are looking for:

    http://jsfiddle.net/L4L67/

    body>div {
      background: #aaa;
      display: flex;
      flex-wrap: wrap;
    }
    
    body>div>div {
      flex-grow: 1;
      width: 33%;
      height: 100px;
    }
    
    body>div>div:nth-child(even) {
      background: #23a;
    }
    
    body>div>div:nth-child(odd) {
      background: #49b;
    }

提交回复
热议问题