Container in Bootstrap
The container in Bootstrap is used to set the padding around the content as well left and right margin to the content. Although, it is also used to align the content horizontally center on the page in the case of fixed width container. There are three types of Bootstrap container classes:
Bootstrap Container
In Bootstrap .container class provides responsive fixed width container means it's width will be changed according to viewport width of the device. It is clear that it can not take full available width of the viewport. Although, it has by default left and right margin.
Why We Use .container Class ? Since it is a container for a row means it contains one or more than one row inside the container. While, a row is a container for columns.
领英推荐
Bootstrap Fluid Container
The .container-fluid class provides a full width container that covers complete available viewport width of the device. It can also a container for a row that is a container for Bootstrap columns. The Bootstrap fluid container will also takes complete width whenever the viewport is resized.
Responsive Container
Bootstrap responsive containers have 100% width till the specified breakpoint and then max-width for higher breakpoints.
For example, the .container-sm class takes 100% width to start until the sm breakpoint is reached. Then, it scales up with md, lg, xl, and xxl.
Bootstrap Responsive Container Classes: