Floated divs won't stack properly (without gaps)

前端 未结 3 1035
温柔的废话
温柔的废话 2021-01-24 00:50

I have a container with many floated items. The problem is when the size of at least one of them changes, a gap occurs. Is there any way to force them to fill these gaps?

<
3条回答
  •  不知归路
    2021-01-24 01:36

    You could add something like this to your .wpr class:

        display: flex;
        flex-flow: column wrap;
        max-height: 800px;
    

    This is kinda hacky though and I think it does require a max-height. You could also look into a jquery plugin like https://isotope.metafizzy.co/layout-modes/masonry.html

提交回复
热议问题