# Grid The Grid system provides a flexible way to create both column-based and row-based layouts. It supports various column counts, column spans, and responsive behaviors to create complex layouts easily. ### When to Use Grid Use Grid inside[Layout](/framework/docs/layout) when you need a strict, grid-based layout. Grid gives you precise control over column count and span, so items align to a consistent rhythm and every element snaps to the same underlying grid. #### Grid-Based Distribution You define how many columns the grid has with `grid--cols-{number}`, and you can let individual cells span multiple columns with `col--span-{number}`. The result is a predictable, aligned layout where everything shares the same column structure. Ideal for Swiss-style or editorial designs where visual consistency matters. #### Multiple Grids and Nesting You can place multiple Grid components as direct children of Layout; Layout's modifiers (row/col, alignment, stretch) arrange those grids within the available space. Inside each grid cell, you can nest[Flex](/framework/docs/flex) for row or column flexibility within that cell. For example, a grid cell that stacks items vertically or aligns them horizontally. #### Compared to Flex and Columns Choose Grid when you need fixed column structure and spans. If you need content-sized flexibility (items that grow or shrink by content), use Flex. If you have lots of same-type data and want the system to handle column distribution and overflow, use[Columns](/framework/docs/columns) . ### Related [Columns](/framework/docs/columns)[Flex](/framework/docs/flex)[Gap](/framework/docs/gap)[Layout](/framework/docs/layout) ### Ways to Define the Grid The grid system provides two ways to define column layouts: - **Column Count:** Set `grid--cols-{number}` on the parent to create equal-width columns - **Column Spans:** Set `col--span-{number}` on individual columns to control their width #### Column Count Use `grid--cols-{number}` to specify any number of columns. Here are examples with 4 and 3 columns: Col 1/4 Col 1/4 Col 1/4 Col 1/4 Col 1/3 Col 1/3 Col 1/3 GridColumn Count