

I initially noted that web developers were asking for the feature back in January 2017, and while I have some concerns as to whether this really is a grid thing (and also the potential for accessibility problems due to content reordering), I am glad it is moving forward. Doing layout with JavaScript - in particular with the large number of items that often benefit from this type of layout - is never going to perform well. Therefore, in order to achieve masonry, it still requires JavaScript. See the Pen Masonry autoflow example by Rachel Andrew ( on CodePen. While you can fill all of the gaps in this way, the layout is still a grid and therefore there is no way to cause items to rise up into the gaps left by shorter items. When designers first saw Grid layout, they often thought that auto-placement along with the dense packing mode might achieve masonry. See the Pen Masonry Multicol example by Rachel Andrew ( on CodePen. if this were search results), then the apparent first items in the top row aren’t actually the ones that came back first.

Therefore, if the first items have the highest priority (e.g. However, the order of the boxes runs down the columns. In the example below, you see something which looks visually like a masonry layout. The closest way to achieve the look of this type of layout is to use Multi-column Layout. We can come close to a masonry layout in a couple of ways. There are a number of JavaScript tools to help you create this kind of layout, such as David DeSandro’s Masonry plugin. The most well-known example of masonry is on Pinterest, and you will sometimes hear people refer to the layout as a “Pinterest layout”. It’s similar to a grid layout with auto-placement, but without sticking to a strict grid for the rows. When they move onto the next line, items will move up into any gaps left by shorter items in the first line. What Is A Masonry Layout?Ī masonry layout is one where items are laid out one after the other in the inline direction. While this is a feature you won’t be able to use in production right now, your feedback would be valuable to help make sure it serves the requirements that you have for this kind of layout. In this article, I’ll explain the draft spec, with examples that you can try out in Firefox Nightly. In this article, Rachel Andrew explains how it works with the help of a couple of demos you can try out in Firefox Nightly.Ī Level 3 of the CSS Grid specification has been published as an Editor’s Draft, this level describes a way to do Masonry layout in CSS. There is now a specification for native CSS masonry layout, as part of the Grid Layout spec.
