- Bootstrap Container is what makes bootstrap responsive
- There are two important container class of bootstrap
- container class used for fixed container
- Has fixed width and changes layout at certain breakpoint
- Has padding of 15px left and right
- container-fluid class used for fluid container
- Stretches to 100% of the screen size of parent element,
- Has padding of 15px left and right
- container class used for fixed container
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"> <header class="jumbotron"> <h1>Heading1</h1> </header> <H1>Hello World</H1> <p>Hello is this is container class which is fixed width</p> </div> <div class="container-fluid"> <header class="jumbotron"> <h1>Heading1</h1> </header> <H1>Hello World</H1> <p>Hello is this is container-fluid class which is fluid width</p> </div> </body> </html>
Output :