- Bootstrap contains 12 grids.
- md for medium sized devices (Works for most of the devices)
- lg for large devices.
- sm for small devices.
- xs for extra small devices.
Example :
<html> <head> <title></title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script> </head> <body> <div class="container-fluid"> <!-- md support most of the desktops --> <div class="row"> <div class="col-md-6" style="background-color: lightblue;">Hello</div> <div class="col-md-2" style="background-color: lightgreen;">World</div> <div class="col-md-4" style="background-color: orange;">World</div> </div> <!-- xs for extra small devices --> <div class="row"> <div class="col-xs-6" style="background-color: lightblue;">Hello</div> <div class="col-xs-2" style="background-color: lightgreen;">World</div> <div class="col-xs-4" style="background-color: orange;">World</div> </div> <!-- sm for small devices --> <div class="row"> <div class="col-sm-6" style="background-color: lightblue;">Hello</div> <div class="col-sm-2" style="background-color: lightgreen;">World</div> <div class="col-sm-4" style="background-color: orange;">World</div> </div> <!-- lg for large devices --> <div class="row"> <div class="col-lg-6" style="background-color: lightblue;">Hello</div> <div class="col-lg-2" style="background-color: lightgreen;">World</div> <div class="col-lg-4" style="background-color: orange;">World</div> </div> </div> </body> </html>
Output :