--- layout: default.html title: Grid System description: Shoelace features a 12-column grid system based on Bootstrap 4’s grid. --- ## Grid System Shoelace features a 12-column grid system based on [Bootstrap 4’s grid](https://getbootstrap.com/docs/4.0/layout/grid/). It’s flexible, easy to use, and fully responsive. ### Structure The grid consists of containers, rows, and columns. A basic, two-column grid looks like this: ```html
1st column
2nd column
```
1st column
2nd column
Containers can be used to wrap sections of your page. Use the `container` class to create a responsive, fixed-width container or the `container-fluid` class to create a fluid container. Rows are used to group columns horizontally and can only contain columns as child elements. Columns are where you’ll put your content. ### Creating Columns Columns are equal width by default. The grid will automatically determine the appropriate size for columns with the `col` class. ```html
1
1
2
1
2
3
```
col
col
col
col
col
col
To set the width of a column, use the `col-*` modifier with a value of 1–12. Widths are calculated based on a total of 12 possible columns. Additional columns will wrap to a new line. ```html
col-2
col-4
col-6
```
col-2
col-4
col-6
You can mix and match sized columns with unsized columns for flexibility. Unsized columns will take up equal widths of the remaining space. ```html
col
col-6
col
```
col
col-6
col
To size a column based on its content, use `col-auto`. ```html
col
Sized to fit
col
```
col
Sized to fit
col
### Making Columns Responsive There are five responsive tiers in Shoelace: `xs`, `sm`, `md`, `lg`, and `xl`. You can use these tiers to change the way the grid responds at various breakpoints. The grid is mobile-first, so the default tier is `xs`. Use the `col-[sm|md|lg|xl]-*` modifier to target a specific tier. Note that tiers are based on minimum widths, so using `col-sm-6` will target `sm`, `md`, `lg`, and `xl` screens. Of course, you can target multiple tiers on the same column as needed. For example, the following columns will stack on `xs` screens, take up 50% each (6 out of 12 columns) on `sm` screens, and 75% and 25% respectively on `md`, `lg`, and `xl` screens. ```html
1st column
2nd column
```
1st column
2nd column
### Offsetting Columns You can offset columns using `offset-*` and `offset-[sm|md|lg|xl]-*` modifiers. To reset an offset at a specific tier, use `offset-[sm|md|lg|xl]-0`. ```html
left
center
right
```
left
center
right
### Aligning Columns Columns can be aligned with the `row-[start|center|end|around|between]` and `row-[sm|md|lg|xl]-[start|center|end|around|between]` modifiers. ```html
1st
2nd
1st
2nd
1st
2nd
1st
2nd
1st
2nd
```
1st
2nd
1st
2nd
1st
2nd
1st
2nd
1st
2nd
### Reordering Columns You can control the visual order of columns using the `order-*` and `order-[sm|md|lg|xl]-*` modifiers. Note that columns without an order modifier will not be affected. ```html
1st (unordered)
2nd
3rd
```
1st (unordered)
2nd
3rd
### Hiding Columns You can hide columns based on breakpoints using [display utilities](utilities.html#display-utilities). ```html
hide-xs
hide-sm
hide-md
hide-lg
hide-xl
```
hide-xs
hide-sm
hide-md
hide-lg
hide-xl
### Removing Gutters By default, columns have horizontal spacing around them to create “gutters.” You can remove this spacing by applying the `row-flush` modifier to the parent row. ```html
...
``` For an edge-to-edge design, refrain from using `container` and `container-fluid` around the row. ### Nested Grids Grids can be nested. Simply add a new row inside of a column. ```html
outer, col-8
inner, col-3
inner, col-9
```
outer, col-8
inner, col-3
inner, col-9