Bootstrap – Containers


Bootstrap – Containers



”;



This chapter will discuss about Bootstrap containers. Containers are used to pad content within them.


Containers are required for default grid system (Grid system uses a series of containers, rows and columns to align content). Containers are used to contain, pad, and center the content within them. Containers can also be nested, though most layouts don”t require a nested container.



There are three different container classes in Bootstrap:


  • .container (sets responsive max-widths).

  • .container-{breakpoint} (width: 100% until specified breakpoint).

  • .container-fluid (width: 100% at all breakpoints).


How the max-width of the container (when compared to original .container and .container-fluid) varies across each breakpoint is shown in the below table:

Examples of the same can be seen in chapter Grid Demo










Extra small
<576px
Small
≥576px
Medium
≥768px
Large
≥992px
X-Large
≥1200px
XX-Large
≥1400px
.container 100% 540px 720px 960px 1140px 1320px
.container-sm 100% 540px 720px 960px 1140px 1320px
.container-md 100% 100% 720px 960px 1140px 1320px
.container-lg 100% 100% 100% 960px 1140px 1320px
.container-xl 100% 100% 100% 100% 1140px 1320px
.container-xxl 100% 100% 100% 100% 100% 1320px
.container-fluid 100% 100% 100% 100% 100% 100%


Default Containers

Use .container class which creates a responsive fixed-width container.