How do you float elements without a vertical gap?

后端 未结 9 2005
野的像风
野的像风 2020-11-30 16:03

I am trying to float elements left. Here is my css:

width: 320px;
float: left;
border: 1px solid #ccc;
margin-top: 10px;
margin-right: 10px;
border-radius: 5         


        
9条回答
  •  我在风中等你
    2020-11-30 16:32

    What you are attempting to do is known as a "masonry layout" that is despite the element height being variable, it always lines up perfectly with the element above it.

    It would take too long to go into how to designing your own, my advice is you do some googling (with the bolded text). Also here are a few links to a few frameworks commonly used:

    http://masonry.desandro.com/

    http://demosthenes.info/blog/844/Easy-Masonry-Layout-With-Flexbox

提交回复
热议问题