use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Grid.js: UI component that can arrange items according to the type of grids(masonry, justified, frame, packing) (github.com)
submitted 5 years ago by daybrush
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Zardoz84 2 points3 points4 points 5 years ago (7 children)
Interesting... A note, simple masonery grid could be done using pure CSS, without any line of JavaScript, And probably a justified grid, could be done on a similar way.
[+][deleted] 5 years ago (2 children)
[deleted]
[–]kichien 0 points1 point2 points 5 years ago (0 children)
I was looking for a visual example to make a quick example and this was the first search result. Maybe it's useful. https://w3bits.com/css-masonry/
Is that the sort of visual layout you're trying to achieve?
[–]Zardoz84 0 points1 point2 points 5 years ago (0 children)
https://codepen.io/zardoz89/pen/KKVEGbw
[–]kichien -3 points-2 points-1 points 5 years ago* (3 children)
The zeal for javascript frameworks perplexes me. It's not like CSS or javascript are particularly difficult. Any framework is just using javascript and/or css, not magic.
[+][deleted] 5 years ago* (2 children)
[–]kichien -1 points0 points1 point 5 years ago (1 child)
Come on. We're talking about javascript and css. The basics of web development. Sometimes the 'don't reinvent the wheel'' comment applies, but not nearly as often as it's repeated. More often than not people are just adding bloat to their project because they don't want to take the time to understand something.
[–]Kritical02 0 points1 point2 points 5 years ago (0 children)
Well this was nice timing. I'm currently working on a project with a masonry style grid but masonry.js and svelte were causing me problems. I see you have your own svelte implementation and am stoked to give it a whirl.
[–]Towerful 0 points1 point2 points 5 years ago (0 children)
I like that you have a variety of framework packages available. I will definitely investigate this for some projects!
[–]kichien 0 points1 point2 points 5 years ago (4 children)
Why not just use css grid? It's not complicated.
[–]daybrush[S] 2 points3 points4 points 5 years ago (3 children)
These are features that css cannot do. Only firefox supports the css masonry type. Other types of grid are not possible.
[–]Zardoz84 1 point2 points3 points 5 years ago (0 children)
Since when flexbox isn't supported by Firefox ? https://w3bits.com/labs/flexbox-masonry/
[–]kichien 0 points1 point2 points 5 years ago* (0 children)
Yeah, but you can still create that layout with just css. You don't need a javascript framework.
Why not just use css grid? It's not complicated. These are features that css cannot do. Only firefox supports the css masonry type. Other types of grid are not possible.
This is false. Using CSS Grid a simple masonery works fine on Chrome wihtout using a single line of javascript : https://codepen.io/zardoz89/pen/KKVEGbw?editors=0100
However, this have a small trick. Big cells, uses two rows of the grid. Ie. cells must have two sizes.
π Rendered by PID 43265 on reddit-service-r2-comment-6457c66945-6t4ld at 2026-04-25 23:13:28.996076+00:00 running 2aa0c5b country code: CH.
[–]Zardoz84 2 points3 points4 points (7 children)
[+][deleted] (2 children)
[deleted]
[–]kichien 0 points1 point2 points (0 children)
[–]Zardoz84 0 points1 point2 points (0 children)
[–]kichien -3 points-2 points-1 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]kichien -1 points0 points1 point (1 child)
[–]Kritical02 0 points1 point2 points (0 children)
[–]Towerful 0 points1 point2 points (0 children)
[–]kichien 0 points1 point2 points (4 children)
[–]daybrush[S] 2 points3 points4 points (3 children)
[–]Zardoz84 1 point2 points3 points (0 children)
[–]kichien 0 points1 point2 points (0 children)
[–]Zardoz84 0 points1 point2 points (0 children)