Bootstrap 4 Container And Grid, What is Bootstrap Grid System ?

Bootstrap 4 Container And Grid, What is Bootstrap Grid System ?

Bootstrap 4 Container And Grid:

Fixed Container:

Use .Container class to create a responsive, fixed-width container.

Example:

  1. <!doctype html>
  2. <html lang="en">
  3.   <head>
  4.     <!-- here Required meta tags -->
  5.     <meta charset="utf-8">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7.     <!-- here Bootstrap CSS -->
  8.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  9.     <title>Bootstrap, Hello, world!</title>
  10.   </head>
  11.   <body>
  12.     <div class="container">
  13.       <h1>This Is My First Bootstrap Page</h1>
  14.       <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. </p> 
  15.       <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,</p>
  16.     </div>
  17.     <!-- here Optional JavaScript -->
  18.     <!-- here jQuery first, then Popper.js, then Bootstrap JS -->
  19.     <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
  20.     <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
  21.     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
  22.   </body>
  23. </html>

 

Output:

 

 

Fluid Container:

Use .Container-fluid  for a full width container, spanning the entire width of the viewport.

  1. <div class="container-fluid">
  2.   <h1>This Is My First Bootstrap Page</h1>
  3.   <p>This Is My First Bootstrap Page.</p>
  4. </div>

 

Bootstrap 4 Grid:

What is Bootstrap Grid System?

Bootstrap Grid system provides the quick and Convenient way to create Responsive website layouts. Bootstrap’s grid system uses a set of containers, rows, and columns to layout and align content. The latest Bootstrap 4 version introduces the new mobile-first flexbox grid system that appropriately scales up to 12 columns as the device or viewport size increases.

Grid Classes

  1. .col- (extra small devices ------ 576px)
  2. .col-sm- (small devices ------ 576px)
  3. .col-md- (medium devices ------- 768px)
  4. .col-lg- (large devices ------- 992px)
  5. .col-xl- (xlarge devices ------ 1200px)

Four Equal Columns:

  1. <div class="container">
  2.   <h1>Four Equal Columns</h1>
  3.   <div class="row">
  4.     <div class="col" style="background-color:lavender;">This is .col</div>
  5.     <div class="col" style="background-color:orange;">This is .col</div>
  6.     <div class="col" style="background-color:lavender;">This is .col</div>
  7.     <div class="col" style="background-color:orange;">This is .col</div>
  8.   </div>
  9. </div>

 

Output:

Note: If 2, 3, 4, 5, auto add, and Auto Responsive.....

 

 

Two Unequal Responsive Columns:

  1. <div class="container">
  2.   <div class="row">
  3.     <div class="col-sm-4" style="background-color:blue;">.col-sm-4</div>
  4.     <div class="col-sm-8" style="background-color:red;">.col-sm-8</div>
  5.   </div>
  6. </div>

Output:

 

Note: If yous col-sm-6 and col-sm-6, then space 50, 50, and Auto Responsive.....
 

 

 

Thank you.........