如何显示不同高度的div,使其彼此靠近,而不管其高度如何,并且具有特定的边距,就像建筑物一样
我的意思是类似于本网站中的 div http://via.me
我使用了 flaot:left 但它只与最后一个 div 一起 float 并留下一个空白空间
这是我使用的代码 http://jsfiddle.net/D9rHB/6/
最佳答案
我认为 jQuery Masonry在这种情况下,插件将是您要查找的内容:
Masonry is a dynamic grid layout plugin for jQuery. Think of it as the flip-side of CSS floats. Whereas floating arranges elements horizontally then vertically, Masonry arranges elements vertically, positioning each element in the next open spot in the grid. The result minimizes vertical gaps between elements of varying height, just like a mason fitting stones in a wall.
关于html - 使用 CSS 显示不同尺寸的 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11387625/