` that are **both 6 columns wide**. That makes up a total of **24 columns** for the row.
> Didn't you say that a `.row` has a maximum of 12 columns?!
Indeed. But when the number of columns in a row is **more than 12**, Bootstrap will **wrap all elements** causing the excess on a **new 12-columns-wide line**.
> This is very useful! With this behavior, you **don't have to constantly calculate** the number of columns in a row.
> Just define **one** row, and add **as many columns as you want**; they will be properly placed and spaced.
---
#### Offseting columns
.breadcrumbs[
Bootstrap - Layout management >
Bootstrap Grid System >
Adding columns]
Another grid functionnality offered by the Bootstrap Grid System is **offsetting columns**.
Let's say that we want the _Forms_ section and the _Buttons_ section of the `index.html` to be **on the same row**, with both a **5-columns width**, but the former **aligned to the left**, and the latter **aligned to the right**.
We would need to offset our _Color classes_ section by **2 columns** to achieve that (so that the total adds up to 12 columns).
This can be achieved with another set of classes named `.offset-{column}`:
> Again, replace `{column}` with the desired number of columns
```html
```
---
### Responsivness
.breadcrumbs[
Bootstrap - Layout management >
Bootstrap Grid System]
As said before, Bootstrap was build **with smartphones and tablets in mind**, and this is especially visible with the Grid System.
Until now, we have only used the `.col-{column}` set of classes to position our element on the grid.
But there is actually **4 additional sets of classes available**, each of them being applied when the user's screen (or window) has a **certain width**:
| Classe name | Min Screen width |
| :------------------ | :--------------- |
| `.col-sm-{column}` | 576px |
| `.col-md-{column}` | 768px |
| `.col-lg-{column}` | 992px |
| `.col-xl-{column}` | 1200px |
> Using these classes you can dramatically alter the layout of your page, depending on the width of the screen it's rendered on.
> You can also use those screen size names to offset columns: `.offset-sm-{column}`, `.offset-md-{column}`, `.offset-lg-{column}`, `.offset-xl-{column}`.
---
#### Example
.breadcrumbs[
Bootstrap - Layout management >
Bootstrap Grid System >
Responsivness]
To see by ourselves how this works, let's modify the `
`s in the _Color classes_ section.
Add these classes in the `class` attribute of all the `
`:
```html
```
**What does this mean?**
- `.col-6` The content will be 6-column-wide by default
- `.col-sm-4` The content will be 4-column-wide on small screens
- `.col-md-3` The content will be 3-column-wide on middle screens
- `.col-lg-2` The content will be 2-column-wide on large screens
> Go ahead. Try to resize your browser (using your browser's Developer Tools) and see how the content behave.
---
#### What if..?
.breadcrumbs[
Bootstrap - Layout management >
Bootstrap Grid System >
Responsivness]
What if you want your `
`s to be **3-column-wide** for every screen width, except on **extra-small ones**, where they should be **6-column-wide**?
Maybe you would do something like this:
```html
```
> You can see that we have a lot of redundancy: `col-xl-3`, `.col-lg-3`, `.col-md-3` and `.col-sm-3` all do basically the same thing.
Good news is: we can get rid of this redundancy.
> Each screen-dependant class is applied when the screen has the expected width **or is wider** (_unless you defined otherwise_).
In this case, doing this would have the same result:
```html
```
> Since we didn't define any behavior for `xl`, `lg` and `md` screen, Bootstrap will fallback to the closest one, which is `.col-sm-3`.
---
#### Flexibility
.breadcrumbs[
Bootstrap - Layout management >
Bootstrap Grid System >
Responsivness]
You don't have to use all the classes **each time** you want to define how your element should behave.
- By default, any component inside a `.row` but **without column class** for the current screen-width will be **12-column-wide**.
- If you define only **one class**, say a `.col-sm-5`, the element will be **`5`-column-wide** for **small screens and wider**, and **12-column-wide** for all **smaller screens**.
- If you defined only **two classes**, say a `.col-sm-5` and a `.col-lg-2`, the element will be :
- 12-column-wide for screens below `sm` width
- 5-column-wide for `sm` and `md` screens
- 2-column-wide for `lg` and `xl` screens
> Understanding all these behaviors will greatly help you build your layouts.
---
### Responsive utilities
.breadcrumbs[
Bootstrap - Layout management >
Bootstrap Grid System]
Finally, you have the ability to alter the display of any HTML element based on the screen-width.
This can be done with the `.d-{width}-{value}` utility set.
- Replace `{width}` with one of the available screen sizes (`sm`, `md`, `lg` or `xl`)
> Remove it for a class that applies regardless of the screen size
- Replace `{value}` with the type of display to apply to the element for the specified screen size.
_For example: `none` to hide the element, `inline` to display it inline or `block` to display it as a block._
> See [the documentation][d-values] for the complete list of display values
Let's say we want our _Tables_ section to be displayed as a `block` on `sm` and wider screens, and not displayed at all for smaller screens:
```html
```
---
## Resources
.breadcrumbs[
Bootstrap - Layout management]
You will find the final HTML file for this course [here][fef]
**Documentation**
- [Grid System][gs]
- [Responsive utilities][ru]
[flexbox-guide]: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
[grid-guide]: https://css-tricks.com/snippets/css/complete-guide-grid/
[froggy]: https://flexboxfroggy.com/#fr
[bootstrap]: ../bootstrap
[setup]: ../setup
[chrome]: https://www.google.com/chrome/
[vscode]: https://code.visualstudio.com/
[bsef]: https://gist.githubusercontent.com/Tazaf/18732ef01164f7b6348443c4c4748f42/raw/index.html
[block]: ./images/blocks.jpg
[inline]: ./images/inline.jpg
[gs]: https://getbootstrap.com/docs/5.3/layout/grid/
[ru]: https://getbootstrap.com/docs/5.3/layout/utilities/
[fef]: https://gist.githubusercontent.com/Tazaf/329374f10e54818875620c9e03a2609a/raw/dd45d66dd67d71e0c92df9a0388ea22d4c5ff97e/index.html
[bs-screen-sizes]: https://getbootstrap.com/docs/5.3/layout/grid/#grid-options
[d-values]: https://getbootstrap.com/docs/5.3/utilities/display/#notation