In this tutorial we will understand how we can control the responsive behavior of the bootstrap grid system on various screen sizes and devices. Do checkout the part 1 of this tutorial if you have not as this is the continuation of that same part. Click here to check it.
Bootstrap Grid System –
- The grid system in bootstrap framework is one of the most important aspects of bootstrap for achieving the mobile responsive properties.
- The grid system helps divide the entire screen into 12 parts.
- This grid system consists of 3 main CSS class namely – container, row and columns.
- All the responsive behavior is achieved by wrapping the content inside the columns(col class applied to division or section or block level elements) which are wrapped inside rows which are
- ultimately wrapped inside the container.
- So the hierarchy goes as follows – container > rows > columns
We will use different column classes provided inbuilt in the bootstrap library to change the orientation of columns depending on which size of device is active based on the device width.
By default bootstrap has categorized 5 types of devices –
- xs – extra small (width less than 576px)
- sm – small (width between 576px & 768px)
- md – medium (width between 768px & 992px)
- lg – large (width between 992px & 1200px)
- xl – extra large (width greater than 1200px)
More information of grid system – https://getbootstrap.com/docs/4.1/layout/grid/
Setting up everything Library into our Project Offline –
Download this entire test code folder which will the full folder hierarchy with the necessary library files already set up – DOWNLOAD HERE
The folder hierarchy should look like this –
- test code
- style.css (our custom css file)
- all.css (the only one we need to link in our project for font awesome icons)