` 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 *Icons* section and the *Buttons* section of the `index.html` to be **on the same row**, with both a **4-columns width**, but the former **aligned to the left**, and the latter **aligned to the right**.
We would need to offset our *Buttons* section by **4 columns** to achieve that. And this can be done by using the `.col-md-offset-*`:
```html
```
???
The `*` is to be replaced by the number of columns you want to offset your element.
---
### 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-md-*` set of classes to position our element on the grid.
But there is actually **4 sets of classes available**, each of them being activated when the user's screen (or window) has a **certain width**:
| Classes name | Screen width |
| :------------ | :------------- |
| `.col-xs-*` | < 768px |
| `.col-sm-*` | ≥ 768px |
| `.col-md-*` | ≥ 992px |
| `.col-lg-*` | ≥ 1200px |
Using these classes you can dramatically alter the layout of your page, depending on the width of the screen it's rendered on.
---
#### 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-lg-2` The content will be 2-column-wide on large screens
* `.col-md-3` The content will be 3-column-wide on middle screens
* `.col-sm-4` The content will be 4-column-wide on small screens
* `.col-xs-6` The content will be 6-column-wide on extra-small screens
> Go ahead. Try to resize your browser (using the Developer Tools of Chrome) 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 widht, except on **extra-small ones**, where they should be **6-column-wide**?
Maybe you'd do something like this:
```html
```
> You can see that we have a lot of redundancy: `.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 apparent redundancy.
> Each screen-dependant class is activated when the screen has the correct widht **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 `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 the 4 classes **each time** you want to define how your element should behave.
* By default, any component **without adequate column class** for the current screen-width will be **12-column-wide**.
* If you define **one class**, say a `.col-sm-5`, the element will be **12-column-wide** for all **narrower screens** and , here, **`5`-column-wide** for all **wider screens**.
* If you defined **two classes**, say a `.col-sm-5` and a `.col-lg-2`, the element will be :
* 12-column-wide for `xs` screens
* 5-column-wide for `sm` and `md` screens
* 2-column-wide for `lg` 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 show or hide HTML element based on the screen-width.
This can be done by using the `.visible-*-*` and `.hidden-*` set of classes.
The first `*` in both these set must be replaced by one of the available screen sizes (`xs`, `sm`, `md`, `lg`).
With the `.visible-*-*` classes, the second `*` is used to indicate how the element should be shown:
* as a block element with the `.visible-*-block` classes
* as an inline element with the `.visible-*-inline` classes
* as an inline-block element with the `.visible-*-inline-block` classes
Let's we want our *Tables* section to be hidden on extra-small (`xs`) screens:
```html
```
---
## Resources
.breadcrumbs[
Bootstrap - Layout management]
You will find the final HTML file for this course [here][fef]
**Documentation**
* [Grid System][gs]
* [Bootstrap Grid example][bge]
* [Responsive utilities][ru]
[bootstrap]: ../bootstrap
[projset]: ../masrad-project-setup
[chrome]: https://www.google.com/chrome/
[sublime]: https://www.sublimetext.com/
[bsef]: https://gist.githubusercontent.com/Tazaf/18732ef01164f7b6348443c4c4748f42/raw/9f1dec778546a4d9741f1d17b08212c5606c26ca/index.html
[block]: ./images/blocks.jpg
[inline]: ./images/inline.jpg
[gs]: http://getbootstrap.com/css/#grid
[ru]: http://getbootstrap.com/css/#responsive-utilities
[bge]: http://getbootstrap.com/examples/grid/
[fef]: https://gist.githubusercontent.com/Tazaf/329374f10e54818875620c9e03a2609a/raw/f8bac757a5fdad65bc8c8d8e90e802e064615abe/index.html