Can I order my CSS columns horizontally instead of vertically?

前端 未结 5 1824
南笙
南笙 2021-02-01 17:25

Here is my code:



        
5条回答
  •  太阳男子
    2021-02-01 18:09

    Is even easier:

    .inner:nth-child(4n+1) {
        clear: left;
    }
    
    .inner {
        float: left;
        margin: 5px;
    }
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12

    You can apply float: left and clear float: left every 4n+1 elements.

    Ref:

    :nth-child

提交回复
热议问题