|
2 | 2 |
|
3 | 3 | # Grids |
4 | 4 |
|
| 5 | +## Introduction |
| 6 | + |
5 | 7 | Grids are based on a 12 column system, which can adapt to the size of the viewing screen. |
6 | 8 |
|
7 | 9 | A `grid` directive can be set with the number of default columns (1 to 12); |
@@ -65,6 +67,8 @@ short text content |
65 | 67 | ::: |
66 | 68 | :::: |
67 | 69 |
|
| 70 | +## Placing a card in a grid |
| 71 | + |
68 | 72 | The `grid-item-card` directive is a short-hand for placing a card content container inside a grid item (see [Cards](./cards.md)). Most of the `card` directive's options can be used also here: |
69 | 73 |
|
70 | 74 | ::::{grid} 2 |
|
90 | 94 | ```` |
91 | 95 | ````` |
92 | 96 |
|
| 97 | +## Controlling spacing between items |
| 98 | + |
93 | 99 | You can set the spacing between grid items with the `gutter` option. |
94 | 100 | Like for grid columns, you can either provide a single number or four for small, medium and large and extra-large screens. |
95 | 101 |
|
|
129 | 135 | ```` |
130 | 136 | ````` |
131 | 137 |
|
| 138 | +## Item level column width |
| 139 | + |
132 | 140 | You can override the number of columns a single item takes up by using the `columns` option of the `grid-item` directive. |
133 | 141 | Given the total columns are 12, this means 12 would indicate a single item takes up the entire grid row, or 6 half. |
134 | 142 | Alternatively, use `auto` to automatically decide how many columns to use based on the item content. |
|
166 | 174 | ```` |
167 | 175 | ````` |
168 | 176 |
|
| 177 | +## Reversing the item order |
| 178 | + |
| 179 | +Use the `grid` directive's `reverse` option to reverse the order of the items. |
| 180 | +This can be useful if you want an item to be on the right side on large screens, but at the top on small screens. |
| 181 | + |
| 182 | +::::{grid} 1 1 2 2 |
| 183 | +:reverse: |
| 184 | + |
| 185 | +:::{grid-item} |
| 186 | +```{image} ./images/ebp-logo.png |
| 187 | +:width: 200px |
| 188 | +:class: sd-m-auto |
| 189 | +``` |
| 190 | +::: |
| 191 | + |
| 192 | +:::{grid-item-card} |
| 193 | +Some text |
| 194 | +::: |
| 195 | + |
| 196 | +:::: |
| 197 | + |
| 198 | +## Nesting grids |
| 199 | + |
169 | 200 | Grids can be nested in other grids to create complex, adaptive layouts: |
170 | 201 |
|
171 | 202 | ::::::{grid} 1 1 2 2 |
@@ -259,6 +290,9 @@ text-align |
259 | 290 | outline |
260 | 291 | : Create a border around the grid. |
261 | 292 |
|
| 293 | +reverse |
| 294 | +: Reverse the order of the grid items. |
| 295 | + |
262 | 296 | class-container |
263 | 297 | : Additional CSS classes for the grid container element. |
264 | 298 |
|
|
0 commit comments