Re:Show HN: Magic Grid – A simple JavaScript library for dyn...
by e-oj on Monday December 24, 2018 @01:03AM
(#18750671)
When the components in a grid have different heights, a single longer or shorter component stretches the whole row or leaves unpleasant whitespace at the bottom.
[ Parent
| on HN ]
Re:Show HN: Magic Grid – A simple JavaScript library for dyn...
by zanny on Monday December 24, 2018 @01:20AM
(#18750734)
You can use auto-flow: dense to have the grid backfill gaps. I haven't had much chance to test its limits cross browser yet though but trivial examples have worked for me so far.
It isn't as optimal a layout system as you can get with javascript but generally so long as all elements are at least half the height of other members of a row it doesn't look offensively bad. And there is room for more sophisticated layout algorithms in the future.
And it generally isn't that hard to pad grid items to be multiples of a common height so they can organically fill consistently.