Floated elements of variable height push siblings down

后端 未结 3 808
既然无缘
既然无缘 2020-11-22 06:15

I have 6 elements which should result in two rows of 3 elements each, so I\'ve floated them. But the content of the elements varies quite a bit, and the layout breaks when

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-22 06:55

    How about a CSS only solution? Add this rule:

    figure:nth-of-type(3n+1) {
        clear:left;
    }
    

    jsFiddle example

提交回复
热议问题