Bootstrap Grid System, Containers And Bootstrap Layout

By Sruthy

By Sruthy

Sruthy, with her 10+ years of experience, is a dynamic professional who seamlessly blends her creative soul with technical prowess. With a Technical Degree in Graphics Design and Communications and a Bachelor’s Degree in Electronics and Communication, she brings a unique combination of artistic flair…

Learn about our editorial policies.
Updated March 7, 2024

This tutorial includes Bootstrap Containers, Bootstrap Grid System, Bootstrap Layout utilities, and Flex with examples:

Please note that we have used Bootstrap version 4 for all examples.

=> Check Here To See A-Z Of Bootstrap Training Tutorials

Bootstrap Containers

Bootstrap 4 Layout

A container is the most basic layout component in Bootstrap 4. It is needed when you are using the default grid system. Usually, containers contain all other elements on the page.

There are three types of containers in Bootstrap 4.

  1. Fixed container (.container class)
  2. Fluid container (.container-fluid class)
  3. Responsive container (.container-{breakpoint} class)

There are four main container breakpoint classes. They are,

  • .container-sm class
  • .container-md class
  • .container-lg class
  • .container-xl class

Bootstrap Fixed Container

The .container class represents a fixed container. It is the default Bootstrap container and also a responsive, fixed-width container. It sets a max-width at every responsive breakpoint.

Example:

<div class="container">
…
</div>

The below table shows how the .container class responds to different screen sizes.

Container classType of deviceWidth
Extra small devices - screen width less than 576px (<576px)100%
Small devices - screen width equal to or greater than 576px (?576px)540px
.containerMedium devices - screen width equal to or greater than 768px (?768px)720px
Large devices - screen width equal to or greater than 992px (?992px)960px
Extra large devices - screen width equal to or greater than 1200px (?1200px)1140px

Bootstrap Fluid Container

The .container-fluid class represents a fluid container. It is width: 100% at all breakpoints. In other words, it is a full-width container, spanning the entire width of the device screen.

Example:

<div class="container-fluid">
...
</div>

The following table shows how the .container-fluid class responds to different screen sizes.

Container classType of deviceWidth
.container-fluidExtra small devices - screen width less than 576px (<576px)100%
Small devices - screen width equal to or greater than 576px (?576px)100%
Medium devices - screen width equal to or greater than 768px (?768px)100%
Large devices - screen width equal to or greater than 992px (?992px)100%
Extra large devices - screen width equal to or greater than 1200px (?1200px)100%

Example:

Let’s see an example to see the differences between .container and .container-fluid classes.

<html lang="en">
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css">
<title></title>
</head>
<body>
<div class="container">
<h1>Bootstrap 4 simple container (.container class)</h1>
<p>
<button type="button" class="btn btn-info">example button 1</button>
<button type="button" class="btn btn-danger">example button 2</button>
</p> 
</div>

<div class="container-fluid">
<h1>Bootstrap 4 fluid container (.container-fluid class)</h1>
<p>
<button type="button" class="btn btn-info">example button 1</button>
<button type="button" class="btn btn-danger">example button 2</button>
</p>
</div> 
</body>
</html>

Output:

bootstrap fluid container

Bootstrap Responsive Container

Responsive containers were newly introduced in Bootstrap version 4.4. The .container-{breakpoint} class (.container-sm|md|lg|xl class) represents a responsive container. It is width: 100% until the specified breakpoint.

Example:

<div class="container-sm">100% wide until small breakpoint</div>
<div class="container-md">100% wide until medium breakpoint</div>
<div class="container-lg">100% wide until large breakpoint</div>
<div class="container-xl">100% wide until extra-large breakpoint</div>

The following table shows how the .container-sm|md|lg|xl classes respond to different screen sizes.

Container classExtra mall device
<576px
Small device
?576px
Medium device
?768px
Large device
?992px
Extra-large device
?1200px
.container-sm100%540px720px960px1140px
.container-{breakpoint}.container-md100%100%720px960px1140px
.container-lg100%100%100%960px1140px
.container-xl100%100%100%100%1140px

Summary Of Containers

The below table shows a summary of how different types of container classes respond to different screen sizes.

Container classExtra small device
<576px
Small device
?576px
Medium device
?768px
Large device
?992px
Extra-large device
?1200px
.container100%540px720px960px1140px
.container-{breakpoint}.container-sm100%540px720px960px1140px
.container-md100%100%720px960px1140px
.container-lg100%100%100%960px1140px
.container-xl100%100%100%100%1140px
.container-fluid100%100%100%100%100%

Bootstrap Grid System

The Bootstrap 4 grid system is responsive. It will automatically adjust the columns for different screen sizes. The grid system consists of 12 columns. However, you don’t need to use all 12 columns.

Further, you can combine the Bootstrap columns to create wider columns that have the sum of 12 or lesser. Some examples are shown below.

bootstrap grid system

Grid Classes

The Bootstrap 4 grid system consists of five classes.

  1. .col class
  2. .col-sm class
  3. .col-md class
  4. .col-lg class
  5. .col-xl class
Grid classType of deviceWidth
.colExtra small devicesScreen width less than 576px (<576px)
.col-smSmall devicesScreen width equal to or greater than 576px (?576px)
.col-mdMedium devicesScreen width equal to or greater than 768px (?768px)
.col-lgLarge devicesScreen width equal to or greater than 992px (?992px)
.col-xlExtra-large devicesScreen width equal to or greater than 1200px (?1200px)

Basic Structure Of The Grid System

The below code snippet shows the basic structure of the Bootstrap 4 grid system.

Note:

* is for sm, md, lg or xl, which represent small, medium, large or extra-large screen sizes.

# For Bootstrap row size (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 or 12).

<!-- Adjust the grid layout by specifying the column width and (/or) device screen size -->
<div class="row">
<div class="col-*-#"></div>
<div class="col-*-#"></div>
...
</div>
<div class="row">
<div class="col-*-#"></div>
<div class="col-*-#"></div>
...
</div>

<!-- Bootstrap automatically adjust the grid layout -->
<div class="row">
<div class="col"></div>
<div class="col"></div>
...
</div>

Note: Use the following code skeleton to run the rest of the below example codes.

<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-3">
<!-- add code here -->
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

Bootstrap Equal Columns

Example: Creating three equal columns.

<div class="row">
<div class="col bg-danger">Item 1</div>
<div class="col bg-warning">Item 2</div>
<div class="col bg-success">Item 3</div>
</div>

Output:

bootstrap equal columns

Responsive Columns

Code:

<div class="row">
<div class="col-md-3 bg-danger">Item 1</div>
<div class="col-md-3 bg-warning">Item 2</div>
<div class="col-md-3 bg-success">Item 3</div>
</div>

Output:

bootstrap responsive columns

Bootstrap Layout Utilities

Borders

The following table shows a summary of border classes.

Class Description
Borders - subtractive.border-0No border
.border-top-0Remove top border
.border-right-0Remove right border
.border-bottom-0Remove bottom border
.border-left-0Remove left border
Border color.border-primaryAdd primary color to the border
.border-secondaryAdd secondary color to the border
.border-successAdd success color to the border
.border-dangerAdd danger color to the border
.border-warningAdd warning color to the border
.border-infoAdd info color to the border
.border-lightAdd light color to the border
.border-darkAdd dark color to the border
.border-whiteAdd white color to the border
Border radius.roundedAdd round border
.rounded-topAdd a round top border
.rounded-rightAdd a round right border
.rounded-bottomAdd a round bottom border
.rounded-leftAdd a round left border
.rounded-circleAdd round in a circle
.rounded-0No round
.rounded-smAdd a small round border
.rounded-lgAdd a large round border

Example:

<!-- Add this <style> tag inside the <head> tag -->

<style>
.border {
display: inline-block;
width: 50px;
height: 50px;
margin: 10px;
}
</style>
<h3 class="mt-3">Border Subtractive</h3>
<span class="border border-0"></span>
<span class="border border-top-0"></span>
<span class="border border-right-0"></span>
<span class="border border-bottom-0"></span>
<span class="border border-left-0"></span>

<h3 class="mt-3">Border Color</h3>
<span class="border border-primary"></span>
<span class="border border-secondary"></span>
<span class="border border-success"></span>
<span class="border border-danger"></span>
<span class="border border-warning"></span>
<span class="border border-info"></span>
<span class="border border-light"></span>
<span class="border border-dark"></span>
<span class="border border-white"></span>

<h3 class="mt-3">Border Radius</h3>
<span class="border rounded-sm"></span>
<span class="border rounded"></span>
<span class="border rounded-lg"></span>
<span class="border rounded-top"></span>
<span class="border rounded-right"></span>
<span class="border rounded-bottom"></span>
<span class="border rounded-left"></span>
<span class="border rounded-circle"></span>
<span class="border rounded-0"></span>

Output:

bootstrap borders

Spacing – Padding And Margin

The following list shows the default padding of the .container class.

  • Top padding – 0px
  • Bottom padding – 0px
  • Left padding – 15px
  • Right padding – 15px

The below table shows a summary of Bootstrap spacing (padding and margin) classes.

ClassDescription
property classespsets the padding
msets the margin
sides classestsets the top padding/margin
bsets the bottom padding/margin
lsets the left padding/margin
rsets the right padding/margin
xsets both the left padding/margin and right padding/margin
ysets both the top padding/margin and bottom padding/margin
blanksets padding or margin on all sides (left padding/margin, right padding/margin, top padding/margin and bottom padding/margin)
size classes0sets padding / margin to 0
1sets padding / margin to .25rem
2sets padding / margin to .5rem
3sets padding /margin to 1rem
4sets padding /margin to 1.5rem
5sets padding /margin to 3rem
autosets margin to auto
n1sets margin to -.25rem
n2sets margin to -.5rem
n3sets margin to -1rem
n4sets margin to -1.5rem
n5sets margin to -3rem

Example:

<h3 class="text-primary">No padding or no margin</h3>
<div class="bg-primary">Item</div>
<h3 class="text-warning">Have a top margin only</h3>
<div class="mt-5 bg-warning">Item</div>
<h3 class="text-danger">Have a margin on all sides</h3>
<div class="m-5 bg-danger">Item</div>
<h3 class="text-info">Have a top padding only</h3>
<div class="pt-5 bg-info">Item</div>
<h3 class="text-success">Have a padding on all sides</h3>
<div class="p-5 bg-success">Item</div>

Output:

bootstrap spacing

Floats And Responsive Floats

The below table shows a summary of Bootstrap float and responsive float classes.

ClassDescription
Floatsfloat-leftFloat an item to the left
float-rightFloat an item to the right
Responsive floatsfloat-sm-rightFloat an item to the right on small screens or wider
float-md-rightFloat an item to the right on medium screens or wider
float-lg-rightFloat an item to the right on large screens or wider
float-xl-rightFloat an item to the right on extra-large screens or wider
float-noneNo float

Example:

<div class="float-left bg-danger">Float left on all viewport sizes</div><br>
<div class="float-right bg-warning">Float right on all viewport sizes</div><br>
<div class="float-none bg-success">Don't float on all viewport sizes</div>

Output:

bootstrap responsive floats

Center Align

The following table shows a summary of the Bootstrap center align class.

ClassDescription
.mx-autoCenter an item (adds margin-left and margin-right: auto)

Example:

<div class="mx-auto bg-info" style="width:100px">Centered</div>

Output:

center align

Sizing

The following table shows a summary of Bootstrap sizing classes.

Class Description
Width.w-25Width 25%
.w-50Width 50%
.w-75Width 75%
.w-100Width 100%
Height.h-25Height 25%
.h-50Height 50%
.h-75Height 75%
.h-100Height 100%
Max-width.mw-100Max-width 100%
Max-height.mh-100Max- height 100%

Example:

<h3>Width</h3>
<div class="w-25 bg-primary">Width 25%</div>
<div class="w-50 bg-danger">Width 50%</div>
<div class="w-75 bg-warning">Width 75%</div>
<div class="w-100 bg-success">Width 100%</div>
<div class="w-auto bg-info">Width auto</div>

<h3 class="mt-5">Height</h3>
<div style="height: 100px;" class="bg-secondary">
<div class="h-25 bg-primary d-inline-block" style="width: 120px;">Height 25%</div>
<div class="h-50 bg-danger d-inline-block" style="width: 120px;">Height 50%</div>
<div class="h-75 bg-warning d-inline-block" style="width: 120px;">Height 75%</div>
<div class="h-100 bg-success d-inline-block" style="width: 120px;">Height 100%</div>
<div class="h-auto bg-info d-inline-block" style="width: 120px;">Height auto</div>
</div>

Output:

bootstrap sizing

Shadows

The following table shows a summary of Bootstrap shadow element classes.

ClassDescription
shadow-noneNo shadow
shadowDefault shadow
shadow-smSmall shadow
shadow-lgLarge shadow

Example:

<div class="shadow-none p-5 mb-5 bg-light">No shadow</div>
<div class="shadow-sm p-5 mb-5 bg-white">Small shadow</div>
<div class="shadow p-5 mb-5 bg-white">Default shadow</div>
<div class="shadow-lg p-5 mb-5 bg-white">Large shadow</div>

Output:

bootstrap shadow

Block Elements

The following table shows a summary of Bootstrap block element classes.

ClassDescription
d-blockd-blockControls at which
point the element
should be a block
element on a specific
screen size
d-*-blockd-sm-block
d-md-block
d-lg-block
d-xl-block

Example:

<span class="d-block bg-primary">d-block</span>
<span class="d-sm-block bg-danger">d-sm-block</span>
<span class="d-md-block bg-warning">d-md-block</span>
<span class="d-lg-block bg-success">d-lg-block</span>
<span class="d-xl-block bg-info">d-xl-block</span>

Output (Fullscreen):

bootstrap block element full screen

Output (Half screen):

bootstrap block element half screen

Other Display Classes Of Bootstrap Layout

The below table shows a summary of other display classes.

Class Description
.d-noneHides an element
.d-*-none
.d-inlineMakes an inline element
.d-*-inline
.d-inline-blockMakes an inline-block element
.d-*-inline-block

Bootstrap Flex

Flexbox Container And Inline Flexbox Container

Class Description
Flexbox container and
inline flexbox container
.d-flexMakes a flexbox container
.d-*-flex
.d-inline-flexMakes an inline flexbox container
.d-*-inline-flex

Example:

<div class="d-flex p-3 mb-3 bg-info text-white">Flexbox container</div>
<div class="d-inline-flex p-3 bg-info text-white">Inline flexbox container</div>

Output:

bootstrap flexbox container

Horizontal And Vertical Directions

Class Description
Horizontal and vertical direction.flex-*-rowHorizontally display flex items
.flex-*-row-reverseHorizontally display flex items on right align
.flex-*-columnVertically display flex items
.flex-*-column-reverseVertically display flex items on reversed order

Example:

<h3>Horizontal Direction - .flex-row</h3>
<div class="d-flex flex-row bg-info mb-5">
<div class="p-2 bg-danger">Flex item A</div>
<div class="p-2 bg-warning">Flex item B</div>
<div class="p-2 bg-success">Flex item C</div>
</div>
<h3>Horizontal Direction - .flex-row-reverse</h3>
<div class="d-flex flex-row-reverse bg-info mb-5">
<div class="p-2 bg-danger">Flex item A</div>
<div class="p-2 bg-warning">Flex item B</div>
<div class="p-2 bg-success">Flex item C</div>
</div> 
<h3>Vertical Direction - .flex-column</h3>
<div class="d-flex flex-column mb-5">
<div class="p-2 bg-danger">Flex item A</div>
<div class="p-2 bg-warning">Flex item B</div>
<div class="p-2 bg-success">Flex item C</div>
</div>
<h3>Vertical Direction - .flex-column-reverse</h3>
<div class="d-flex flex-column-reverse mb-5">
<div class="p-2 bg-danger">Flex item A</div>
<div class="p-2 bg-warning">Flex item B</div>
<div class="p-2 bg-success">Flex item C</div>
</div>

Output:

Horizontal and Vertical direction

Justified Content

Class Description
Justified content.justify-content-*-startDisplay flex items on left align/start
.justify-content-*-endDisplay flex items on right align/end
.justify-content-*-centerDisplay flex items in the center
.justify-content-*-betweenDisplay flex items in "between"
.justify-content-*-aroundDisplay flex items "around"

Example:

<div class="d-flex justify-content-start bg-info mb-3">
<div class="p-2 bg-danger">Flex item A</div>
<div class="p-2 bg-warning">Flex item B</div>
<div class="p-2 bg-success">Flex item C</div>
</div>
<div class="d-flex justify-content-end bg-info mb-3">
<div class="p-2 bg-danger">Flex item A</div>
<div class="p-2 bg-warning">Flex item B</div>
<div class="p-2 bg-success">Flex item C</div>
</div> 
<div class="d-flex justify-content-center bg-info mb-3">
<div class="p-2 bg-danger">Flex item A</div>
<div class="p-2 bg-warning">Flex item B</div>
<div class="p-2 bg-success">Flex item C</div>
</div>
<div class="d-flex justify-content-between bg-info mb-3">
<div class="p-2 bg-danger">Flex item A</div>
<div class="p-2 bg-warning">Flex item B</div>
<div class="p-2 bg-success">Flex item C</div>
</div>
<div class="d-flex justify-content-around bg-info mb-3">
<div class="p-2 bg-danger">Flex item A</div>
<div class="p-2 bg-warning">Flex item B</div>
<div class="p-2 bg-success">Flex item C</div>
</div>

Output:

bootstrap justified content

Fill

Class Description
Fill / equal width.flex-*-fillForce flex items into widths equal to their content

Example:

<div class="d-flex">
<div class="p-2 flex-fill bg-danger">Flex item A with a lot of content</div>
<div class="p-2 flex-fill bg-warning">Flex item B</div>
<div class="p-2 flex-fill bg-success">Flex item C</div>
</div>

Output:

bootstrap fill

Grow

Class Description
Grow.flex-*-grow-0Does not allow items to grow
.flex-*-grow-1Make items to grow

Example:

<div class="d-flex">
<div class="p-2 flex-grow-1 bg-danger">Flex item A</div>
<div class="p-2 bg-warning">Flex item B</div>
<div class="p-2 bg-success">Flex item C</div>
</div>

Output:

bootstrap grow

Shrink

Class Description
Shrink.flex-*-shrink-0Does not allow items to shrink
.flex-*-shrink-1Make items to shrink

Example:

<div class="d-flex">
<div class="p-2 w-100 bg-danger">Flex item A</div>
<div class="p-2 flex-shrink-1 bg-warning">Flex item B</div>
</div>

Output:

bootstrap shrink

Bootstrap Order

Class Description
Order.order-*-0-12Change the order (0 to 12 ) on small screen sizes

Example:

<div class="d-flex bg-info">
<div class="p-2 bg-danger order-A">Flex item A</div>
<div class="p-2 bg-warning order-B">Flex item B</div>
<div class="p-2 bg-success order-C">Flex item C</div>
</div>

Output:

bootstrap order

Wrap

Class Description
Wrap.flex-*-nowrapDoes not wrap items
.flex-*-wrapWrap items
.flex-*-wrap-reverseReverse the item wrapping

Example:

<h3>Wrap - .flex-nowrap</h3>
<div class="d-flex flex-nowrap border mb-5">
<div class="p-2 bg-info border">Flex item A</div>
<div class="p-2 bg-info border">Flex item B</div>
<div class="p-2 bg-info border">Flex item C</div>
<div class="p-2 bg-info border">Flex item D</div>
<div class="p-2 bg-info border">Flex item E</div>
<div class="p-2 bg-info border">Flex item F</div>
<div class="p-2 bg-info border">Flex item G</div>
<div class="p-2 bg-info border">Flex item H</div>
<div class="p-2 bg-info border">Flex item I</div>
</div>
<h3>Wrap - .flex-wrap</h3>
<div class="d-flex flex-wrap mb-5">
<div class="p-2 bg-info border">Flex item A</div>
<div class="p-2 bg-info border">Flex item B</div>
<div class="p-2 bg-info border">Flex item C</div>
<div class="p-2 bg-info border">Flex item D</div>
<div class="p-2 bg-info border">Flex item E</div>
<div class="p-2 bg-info border">Flex item F</div>
<div class="p-2 bg-info border">Flex item G</div>
<div class="p-2 bg-info border">Flex item H</div>
<div class="p-2 bg-info border">Flex item I</div>
</div> 
<h3>Wrap - .flex-wrap-reverse</h3>
<div class="d-flex flex-wrap-reverse mb-5">
<div class="p-2 bg-info border">Flex item A</div>
<div class="p-2 bg-info border">Flex item B</div>
<div class="p-2 bg-info border">Flex item C</div>
<div class="p-2 bg-info border">Flex item D</div>
<div class="p-2 bg-info border">Flex item E</div>
<div class="p-2 bg-info border">Flex item F</div>
<div class="p-2 bg-info border">Flex item G</div>
<div class="p-2 bg-info border">Flex item H</div>
<div class="p-2 bg-info border">Flex item I</div>
</div>

Output (with reduced browser size):

bootstrap wrap

Align Content

Class Description
Align content.align-content-*-startAlign items from the start
.align-content-*-endAlign items at the end
.align-content-*-centerAlign items in the center
.align-content-*-aroundAlign items "around"
.align-content-*-stretchStretch items

Example:

<div class="d-flex flex-wrap border align-content-start" style="height: 200px">
<div class="p-2 bg-info border">Flex item A</div>
<div class="p-2 bg-info border">Flex item B</div>
<div class="p-2 bg-info border">Flex item C</div>
<div class="p-2 bg-info border">Flex item D</div>
<div class="p-2 bg-info border">Flex item E</div>
<div class="p-2 bg-info border">Flex item F</div>
<div class="p-2 bg-info border">Flex item G</div>
<div class="p-2 bg-info border">Flex item H</div>
<div class="p-2 bg-info border">Flex item I</div>
</div>

Output (with reduced browser size):

bootstrap align content

Align Items

Class Description
Align items.align-items-*-startAlign a rows of items from the start
.align-items-*-endAlign a row of items at the end
.align-items-*-centerAlign a row of items in the center
.align-items-*-baselineAlign a row of items on the baseline
.align-items-*-stretchStretch a row of items

Example:

<div class="d-flex align-items-start flex-column bg-info mb-3" style="height: 150px;">
<div class="mb-auto p-2 bg-danger">Flex item A</div>
<div class="p-2 bg-warning">Flex item B</div>
<div class="p-2 bg-success">Flex item C</div>
</div>

<div class="d-flex align-items-end flex-column bg-info mb-3" style="height: 150px;">
<div class="p-2 bg-danger">Flex item A</div>
<div class="p-2 bg-warning">Flex item B</div>
<div class="mt-auto p-2 bg-success">Flex item C</div>
</div>

Output:

bootstrap align items

Align Self

Class Description
Align self.align-self-*-startAlign a flex item from the start
.align-self-*-endAlign a flex item at the end
.align-self-*-centerAlign a flex item in the center
.align-self-*-baselineAlign a flex item on the baseline
.align-self-*-stretchStretch a flex item

Example:

<div class="d-flex bg-info" style="height:150px">
<div class="p-2 bg-danger border">Flex item A</div>
<div class="p-2 bg-warning border align-self-start">Flex item B</div>
<div class="p-2 bg-success border">Flex item C</div>
</div>

Output:

bootstrap align self

Auto Margins

Class Description
Auto margins.mr-autoPush items to the right
.ml-autoPush items to the left

Example:

<div class="d-flex mb-3 bg-info">
<div class="p-2 bg-danger">Flex item A</div>
<div class="p-2 bg-warning">Flex item B</div>
<div class="p-2 bg-success">Flex item C</div>
</div>

<div class="d-flex mb-3 bg-info">
<div class="mr-auto p-2 bg-danger">Flex item A</div>
<div class="p-2 bg-warning">Flex item B</div>
<div class="p-2 bg-success">Flex item C</div>
</div>

<div class="d-flex mb-3 bg-info">
<div class="p-2 bg-danger">Flex item A</div>
<div class="p-2 bg-warning">Flex item B</div>
<div class="ml-auto p-2 bg-success">Flex item C</div>
</div>

Output:

bootstrap auto margins

Note: Other Bootstrap layout utilities will be discussed in our upcoming tutorials under specific topics.

Frequently Asked Questions

In this section, we will look at some of the frequently asked questions of the Bootstrap layout.

Q #1) What is the most basic layout component of Bootstrap 4?

Answer: Container

Q #2) Briefly describe the types of containers in Bootstrap 4.

Answer: Types of containers are listed below.

They are,

  1. .container class – This class sets a max-width at each responsive breakpoint.
  2. .container-fluid class – This class is width: 100% at all breakpoints.
  3. .container-{breakpoint} class – This class is width: 100% until the specified breakpoint.
  4. .container-sm class
  5. .container-md class
  6. .container-lg class
  7. .container-xl class

Q #3) What are the five classes in the Bootstrap 4 grid system?

Answer:

  1. .col class
  2. .col-sm class
  3. .col-md class
  4. .col-lg class
  5. .col-xl class

Q #4) Does the grid system of Bootstrap 4 support responsive columns?

Answer: Yes

Conclusion

There are three types of Bootstrap containers called .container, .container-fluid and .container-{breakpoint}. The .container-{breakpoint}s are .container-sm, .container-md, .container-lg and .container-xl.

The Bootstrap grid system consists of five classes called .col, .col-sm, .col-md, .col-lg and .col-xl.

The grid system is responsive and it automatically adjusts the columns for different screen sizes. It consists of 12 columns (maximum). You can combine the columns to create wider columns that have the sum of 12 or lesser. It has various utilities to add styles to the layout.

In our upcoming tutorial, we will discuss the typography of Bootstrap.

=> Check Out The Perfect Bootstrap Training Guide Here

Was this helpful?

Thanks for your feedback!

Leave a Comment