Loading
Bootstrap CSS is a collection of predefined classes for responsive web development. You just need to use a particular class to an element on the page.
To utilize all the classes you just need to include bootstrap CSS on the page.
Bootstrap also provides rich bootstrap JavaScript library to add more interactive functionalities on web pages such as transitions, modals, dropdown, tab, tooltip, popover, alert collapse, carousel and much more.
In Header:
<meta name="viewport" content="width=device-width, initial-scale=1">
At Bottom of the page:
Inside the body tag, divide your page into HTML5 Sections.
Dividing page in sections makes design simple and easy to further development and less messy when we want to use different things in different sections.
Inside general detailing section tags use div with
This provides content perfect wrapping and required padding on different screen size.
Now inside the .container/.container-fluid we use .row and .col-*-* bootstrap classes that helps to make everything responsive.
.col-*-* are the classes that makes page responsive for different sizes.
.row and .col classes are like <tr> and <td> respectively.
Not similar to them but you can consider .row as <tr> for table and .col as <td> to understand them properly.
Inside the .container /.container-fluid we make rows and all rows will have columns inside.
To create a row we use div element with .row class and inside that div we use div element with .col-*-* classes.
.col-xx-n: This define on size of ‘xx’ width of the column will be ‘n’
There are 4 sizes:
We can provide more than one .col tag on one div to specify how the width of that div will be on different sizes screen.
For example, if we specify following div:
<div class=”row”> <div class=”col-lg-3 col-md-4 col-sm-6 col-xs-12”> </div> </div>
Column div changes its width based on the device size and width is not defined explicitly. Width is some percentage of parent’s width. So you never get horizontal scroll bar unless there is an element with a larger width defined explicitly.
Conclusion:
Here we saw initialization of bootstrap and basics on structuring the page and how to make it responsive with proper use of bootstrap classes in one of the correct ways.
Bootstrap contains a very large collection of different classes that can be used to design different components of web page responsively and very easy.