Re: [css-grid] Dense Packing (Masonry algorithm)

On Sat, Jul 20, 2013 at 1:53 AM, Henrik Andersson <henke@henke37.cjb.net> wrote:
> Tab Atkins Jr. writes:
>> As a further note, while the classic Masonry jQuery plugin used sparse
>> packing, there have been many requests over the years for dense
>> packing, and several variants that do it.  I can't find the recent JS
>> library that does dense packing that I was looking at previously, but
>> it looks quite nice.
>
> You are right in that Masonry doesn't really do dense layout like described
> here. But at the same time, it doesn't do sparse layout either. It adds to
> the bottom of the shortest column. This gives similar results to dense grid
> layout if the items always have a multiple of the grid height.

Right, Masonry is halfway between the two - it packs sparsely, but in
such a way as to minimize the bottom edge.

However, I've seen JS libraries that do true dense packing.

> I can't think of a CSS layout that does what I just described here. Is there
> one? If not, should there be one?

Possibly!  It would be an interesting feature to consider for Grid L2
- allow items to just flow compactly in one axis rather than aligning
to the grid lines?  Definitely not a feature for the current level,
though.  ^_^

~TJ

Received on Monday, 22 July 2013 16:35:46 UTC