You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/4.0/layout/css-grid.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ With Bootstrap 5, we've added the option to enable a separate grid system that's
22
22
23
23
-**Replace `.col-*` classes with `.g-col-*` classes.** This is because our CSS Grid columns use the `grid-column` property instead of `width`.
24
24
25
-
-**Columns and gutter sizes are set via CSS variables.** Set these on the parent `.grid` and customize however you want, inline or in a stylesheet, with `--bs-columns` and `--bs-gap`.
25
+
-**Columns and gutter sizes are set via CSS variables.** Set these on the parent `.grid` and customize however you want, inline or in a stylesheet, with `--cui-columns` and `--cui-gap`.
26
26
27
27
In the future, Bootstrap will likely shift to a hybrid solution as the `gap` property has achieved nearly full browser support for flexbox.
28
28
@@ -36,7 +36,7 @@ Compared to the default grid system:
36
36
37
37
- As such, unlike `.row`s, `.grid`s have no negative margins and margin utilities cannot be used to change the grid gutters. Grid gaps are applied horizontally and vertically by default. See the [customizing section](#customizing) for more details.
38
38
39
-
- Inline and custom styles should be viewed as replacements for modifier classes (e.g., `style="--bs-columns: 3;"` vs `class="row-cols-3"`).
39
+
- Inline and custom styles should be viewed as replacements for modifier classes (e.g., `style="--cui-columns: 3;"` vs `class="row-cols-3"`).
40
40
41
41
- Nesting works similarly, but may require you to reset your column counts on each instance of a nested `.grid`. See the [nesting section](#nesting) for details.
42
42
@@ -139,15 +139,15 @@ This behavior can be mixed with grid column classes.
139
139
140
140
Similar to our default grid system, our CSS Grid allows for easy nesting of `.grid`s. However, unlike the default, this grid inherits changes in the rows, columns, and gaps. Consider the example below:
141
141
142
-
- We override the default number of columns with a local CSS variable: `--bs-columns: 3`.
142
+
- We override the default number of columns with a local CSS variable: `--cui-columns: 3`.
143
143
- In the first auto-column, the column count is inherited and each column is one-third of the available width.
144
144
- In the second auto-column, we've reset the column count on the nested `.grid` to 12 (our default).
145
145
- The third auto-column has no nested content.
146
146
147
147
In practice this allows for more complex and custom layouts when compared to our default grid system.
148
148
149
149
{{< example class="bd-example-cssgrid" >}}
150
-
<divclass="grid"style="--bs-columns: 3;">
150
+
<divclass="grid"style="--cui-columns: 3;">
151
151
<div>
152
152
First auto-column
153
153
<div class="grid">
@@ -157,7 +157,7 @@ In practice this allows for more complex and custom layouts when compared to our
157
157
</div>
158
158
<div>
159
159
Second auto-column
160
-
<div class="grid" style="--bs-columns: 12;">
160
+
<div class="grid" style="--cui-columns: 12;">
161
161
<div class="g-col-6">6 of 12</div>
162
162
<div class="g-col-4">4 of 12</div>
163
163
<div class="g-col-2">2 of 12</div>
@@ -174,19 +174,19 @@ Customize the number of columns, the number of rows, and the width of the gaps w
174
174
{{< bs-table "table" >}}
175
175
| Variable | Fallback value | Description |
176
176
| --- | --- | --- |
177
-
|`--bs-rows`|`1`| The number of rows in your grid template |
178
-
|`--bs-columns`|`12`| The number of columns in your grid template |
179
-
|`--bs-gap`|`1.5rem`| The size of the gap between columns (vertical and horizontal) |
177
+
|`--cui-rows`|`1`| The number of rows in your grid template |
178
+
|`--cui-columns`|`12`| The number of columns in your grid template |
179
+
|`--cui-gap`|`1.5rem`| The size of the gap between columns (vertical and horizontal) |
180
180
{{< /bs-table >}}
181
181
182
-
These CSS variables have no default value; instead, they apply fallback values that are used _until_ a local instance is provided. For example, we use `var(--bs-rows, 1)` for our CSS Grid rows, which ignores `--bs-rows` because that hasn't been set anywhere yet. Once it is, the `.grid` instance will use that value instead of the fallback value of `1`.
182
+
These CSS variables have no default value; instead, they apply fallback values that are used _until_ a local instance is provided. For example, we use `var(--cui-rows, 1)` for our CSS Grid rows, which ignores `--cui-rows` because that hasn't been set anywhere yet. Once it is, the `.grid` instance will use that value instead of the fallback value of `1`.
183
183
184
184
### No grid classes
185
185
186
186
Immediate children elements of `.grid` are grid items, so they'll be sized without explicitly adding a `.g-col` class.
187
187
188
188
{{< example class="bd-example-cssgrid" >}}
189
-
<divclass="grid"style="--bs-columns: 3;">
189
+
<divclass="grid"style="--cui-columns: 3;">
190
190
<div>Auto-column</div>
191
191
<div>Auto-column</div>
192
192
<div>Auto-column</div>
@@ -198,14 +198,14 @@ Immediate children elements of `.grid` are grid items, so they'll be sized witho
@@ -237,10 +237,10 @@ Change the vertical gaps only by modifying the `row-gap`. Note that we use `gap`
237
237
</div>
238
238
{{< /example >}}
239
239
240
-
Because of that, you can have different vertical and horizontal `gap`s, which can take a single value (all sides) or a pair of values (vertical and horizontal). This can be applied with an inline style for `gap`, or with our `--bs-gap` CSS variable.
240
+
Because of that, you can have different vertical and horizontal `gap`s, which can take a single value (all sides) or a pair of values (vertical and horizontal). This can be applied with an inline style for `gap`, or with our `--cui-gap` CSS variable.
241
241
242
242
{{< example class="bd-example-cssgrid" >}}
243
-
<divclass="grid"style="--bs-gap: .25rem1rem;">
243
+
<divclass="grid"style="--cui-gap: .25rem1rem;">
244
244
<divclass="g-col-6">.g-col-6</div>
245
245
<divclass="g-col-6">.g-col-6</div>
246
246
@@ -259,7 +259,7 @@ One limitation of the CSS Grid is that our default classes are still generated b
259
259
For example, you can increase the column count and change the gap size, and then size your "columns" with a mix of inline styles and predefined CSS Grid column classes (e.g., `.g-col-4`).
0 commit comments