The grid module is a layout container to align multiple elements on a grid. As the grid is based on Flexbox, it has favorable behavior such as equal height and easy alignment out of the box. Responsive cell sizing and breakpoints are entirely declarative, where you can optimize for only the sizes you need.
By default, the grid behaves as a flexbox container. Without sizes set on grid cells, they are evenly distributed. The height of a grid cell automatically takes up the height of the tallest grid cell in the row. Both the grid and grid cells have no gutter by default.
that takes up more height
that takes up more height
that takes up
even more height
All cells in a grid row can be aligned to the top, middle, or bottom.
By default, grid cells take up available space in the row. However, if a grid cell has a specific size that does not take up all space in a row, all cells in the row can be aligned to the left, center, right, space-around or space-between.
Individual cells in a row can be aligned to the top, middle, bottom, or have a default alignment.
Cell with no specific alignment
Cell with no specific alignment
Individual cells in a row can be aligned to the left, center, or right.
By default, individual cells take up available space in a row, yet this can overridden per cell.
Horizontal gutters between cells can be enabled at grid level.
Vertical gutters between rows can be enabled at grid level.
A grid can have both horizontal and vertical gutters.
Individual cell sizes can be set per breakpoint.
Grid cells can contain grids to create nested grids.
Grid cells by default will have equal height across a row. Content within a grid cell, however, is aligned based on said content and does not neccessarily align. In the below scenario, the paragraph elements is set to grow, causing any content below it to always be pushed down, no matter the length of the paragraph or the availability of other elements.
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet.
LinkLorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet.
LinkTitle
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet.
LinkLorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio, eveniet.
LinkAlthough a Flexbox-based grid is vastly superior over float-based grids in many ways, Flexbox's main strength lies in layout in a single dimension. This is due to Flexbox calculating container dimensions after the content is loaded, potentially leading to jumpy pages in complicated, multidimensional layouts. As such, Flexbox is recommended for rows of content within a layout, not necessarily for page-level layout. Multi dimensional grids of the future will be based on the CSS Grid Layout Module, once it gains enough support.