@@ -11,9 +11,10 @@ functional layout components.
11
11
12
12
## How it works
13
13
14
- Bootstrap's grid system uses a series of containers, rows, and columns to lay out and align content.
15
- It's built with flexbox and is fully responsive. Below is an example and an in-depth look at how the
16
- grid comes together.
14
+ Bootstrap's grid system uses a series of containers, rows, and columns to layout and align content.
15
+ It's built with
16
+ [ flexbox] ( https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox )
17
+ and is fully responsive. Below is an example and an in-depth look at how the grid comes together.
17
18
18
19
``` html
19
20
<b-container class =" bv-example-row" >
@@ -29,17 +30,18 @@ grid comes together.
29
30
30
31
The above example creates three equal-width columns on small, medium, large, and extra large devices
31
32
using Bootstrap v4's predefined grid classes. Those columns are centered in the page with the parent
32
- .container.
33
-
34
- Here's how it works:
35
-
36
- - Containers provide a means to center your site's contents. Use ` <b-container> ` for fixed width or
37
- ` <b-container fluid> ` for full width.
38
- - Rows are horizontal groups of columns that ensure your columns are lined up properly. We use the
39
- negative margin method on ` <b-row> ` to ensure all your content is aligned properly down the left
40
- side.
41
- - Content should be placed within ` <b-col> ` columns, and only columns may be immediate children of
42
- ` <b-row> ` .
33
+ ` .container ` .
34
+
35
+ Breaking it down, here's how it works:
36
+
37
+ - Containers provide a means to center and horizontally pad your site's contents. Use
38
+ ` <b-container> ` for a responsive pixel width or ` <b-container fluid> ` for ` width: 100% ` across all
39
+ viewport and device sizes.
40
+ - Rows are wrappers for columns. Each column has horizontal ` padding ` (called a gutter) for
41
+ controlling the space between them. This ` padding ` is then counteracted on the rows with negative
42
+ margins. This way, all the content in your columns is visually aligned down the left side.
43
+ - In a grid layout, content must be placed within columns and only columns may be immediate children
44
+ of rows.
43
45
- Thanks to flexbox, grid columns without a set width will automatically layout with equal widths.
44
46
For example, four instances of ` <b-col sm="auto"> ` will each automatically be 25% wide for small
45
47
breakpoints.
@@ -50,20 +52,21 @@ Here's how it works:
50
52
possible 12 per row, at the various breakpoints. So, if you want three equal-width columns at
51
53
breakpoint ` sm ` , you can use ` <b-col sm="4"> ` . the special value ` auto ` can be used to take up the
52
54
remaining available column space in a row.
53
- - Column widths, internally, are set in percentages, so they're always fluid and sized relative to
54
- their parent element.
55
- - Columns have horizontal padding to create the gutters between individual columns, however, you can
56
- remove the margin from ` <b-row> ` and padding from ` <b-col> ` by setting the ` no-gutters ` prop on
57
- ` <b-row> ` .
58
- - There are five grid tiers, one for each responsive breakpoint: all breakpoints (extra small),
59
- small, medium, large, and extra large.
60
- - Grid tiers are based on minimum widths, meaning they apply to that one tier and all those above it
61
- (e.g., ` <b-col sm="4"> ` applies to small, medium, large, and extra large devices).
55
+ - Column ` width ` s are set in percentages, so they're always fluid and sized relative to their parent
56
+ element.
57
+ - Columns have horizontal ` padding ` to create the gutters between individual columns, however, you
58
+ can remove the ` margin ` from ` <b-row> ` and ` padding ` from ` <b-col> ` by setting the ` no-gutters `
59
+ prop on ` <b-row> ` .
60
+ - To make the grid responsive, there are five grid breakpoints, one for each responsive breakpoint:
61
+ all breakpoints (extra small), small, medium, large, and extra large.
62
+ - Grid breakpoints are based on minimum width media queries, meaning ** they apply to that one
63
+ breakpoint and all those above it** (e.g., ` <b-col sm="4"> ` applies to small, medium, large, and
64
+ extra large devices, but not the first ` xs ` breakpoint).
62
65
- You can use predefined grid classes or Sass mixins for more semantic markup.
63
66
64
67
Be aware of the limitations and [ bugs around flexbox] ( https://github.com/philipwalton/flexbugs ) ,
65
68
like the
66
- [ inability to use some HTML elements as flex containers] ( https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers ) .
69
+ [ inability to use some HTML elements as flex containers] ( https://github.com/philipwalton/flexbugs#flexbug-9 ) .
67
70
68
71
## Containers ` <b-container> `
69
72
@@ -109,7 +112,7 @@ the class `row` applied to it, or - in the case of [forms](/docs/components/form
109
112
110
113
## Grid options
111
114
112
- While Bootstrap uses ` ems ` or ` rems ` for defining most sizes, ` px ` s are used for grid breakpoints
115
+ While Bootstrap uses ` em ` s or ` rem ` s for defining most sizes, ` px ` s are used for grid breakpoints
113
116
and container widths. This is because the viewport width is in pixels and does not change with the
114
117
[ font size] ( https://drafts.csswg.org/mediaqueries-3/#units ) .
115
118
@@ -198,8 +201,8 @@ like `<b-col sm="6">`.
198
201
199
202
### Equal-width columns
200
203
201
- For example, here are two grid layouts that apply to every device and viewport, from xs to xl. Add
202
- any number of unit-less classes for each breakpoint you need and every column will be the same
204
+ For example, here are two grid layouts that apply to every device and viewport, from ` xs ` to ` xl ` .
205
+ Add any number of unit-less classes for each breakpoint you need and every column will be the same
203
206
width.
204
207
205
208
``` html
@@ -219,15 +222,16 @@ width.
219
222
<!-- b-grid-equal-width.vue -->
220
223
```
221
224
222
- Equal-width columns can be broken into multiple lines, but there is a
223
- [ Safari flexbox bug] ( https://github.com/philipwalton/flexbugs#11-min-and-max-size-declarations-are-ignored-when-wrapping-flex-items )
224
- that prevents this from working without an explicit flex-basis or border. Our example works thanks
225
- to the border being set; you can do the same with ` .col { border: 1px solid transparent; } ` .
226
- Alternatively, you can set the flex-basis to the width of the column (e.g.,
227
- ` .col { flex: 1 0 50%; } ` ).
225
+ ### Equal-width multi-line
226
+
227
+ Create equal-width columns that span multiple lines by inserting a ` .w-100 ` where you want the
228
+ columns to break to a new line. Make the breaks responsive by mixing ` .w-100 ` with some
229
+ [ responsive display utilities] ( https://getbootstrap.com/docs/4.3/utilities/display/ ) .
228
230
229
- Both these fixes have been documented in a
230
- [ reduced test case outside Bootstrap] ( https://output.jsbin.com/micohor ) .
231
+ There was a [ Safari flexbox bug] ( https://github.com/philipwalton/flexbugs#flexbug-11 ) that prevented
232
+ this from working without an explicit ` flex-basis ` or ` border ` . There are workarounds for older
233
+ browser versions, but they shouldn't be necessary if your target browsers don't fall into the buggy
234
+ versions.
231
235
232
236
``` html
233
237
<b-container class =" bv-example-row" >
0 commit comments