

Combining CSS Grid with Bootstrap Grid
source link: https://www.tuicool.com/articles/hit/mUbAraE
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Before I discovered CSS grid, I used bootstrap grid a lot. Bootstrap grid was a reasonable solution to the many responsiveness issues I had back then as a newbie. Then I discovered CSS grid. CSS grid’s edge over bootstrap grid is its two-dimensional quality (ability to use rows and columns) as opposed to bootstrap’s one dimension row.
On the internet, there are a lot of debates over which is better, when should each be used and how to use them. This confused me a lot. Although I use CSS grid more, I love them both. While CSS grid is considerably more powerful, I find bootstrap grid to be more flexible. Do I really have to choose?
Bootstrap has an in-built grid options system that works across multiple devices and this has helped me eliminate the use of media queries. With the use of bootstrap grid options, I can adequately position <divs> how I want them to appear on different screens without using media queries.
Here’s what I mean

Link to the pen https://codepen.io/Barrisam/pen/KYJgMm
In the code above, I have created a nested grid in <section> with class .section of four columns. I actually want the four columns to each take-up half the screen width in devices less than 998px and to be stacked on each other on a small screen for easy reading. But CSS grid is not giving me this. It remains the same throughout as you can see in the image below.




The nested grid stays the same throughout. I don’t want this. And I don’t want to specify media breakpoints in the CSS.
So I decided to nest a bootstrap grid in the class — .section to see if I could achieve the desired result.

Bootstrap grid layout allows up to 12-columns per row. On a large screen, the four columns are placed side by side. Each column taking up 3 units out of the 12-columns.




On medium screen, the columns now take up 6 units, which is an equal division of the 12-columns into two columns.


While on smaller screens like mobile devices, the columns take up the entire width and are stacked on each other.
CSS grid and bootstrap grid can work together perfectly. Rather than pit them against each other, it’s up to you to find a way to blend these two powerful grids.

Recommend
-
17
Live Coding: Web templating w/ Bootstrap CSS in DjangoSchedule time with mepowered by Calendly
-
9
Just after Christmas I made a fun little Codepen demo rec...
-
10
Forcing Grid Stacking with Bootstrap on Mobile Dec 23, 2021 I recently had the situation where a Bootstrap application: Worked perfectly on a desktop with a side by side l...
-
8
Custom template html / css bootstrap for wordpress advertisements I have a custom bootstrap webpage created wit...
-
6
Bootstrap 4 and CSS architecture at scale Full Stack Radio
-
12
15 Best CSS Frameworks: Professional Bootstrap and Foundation Alternatives Whether you are a CSS expert or a front-end beginner, using the right CSS framework is crucial for your daily tasks. There are numerous frameworks whose ultima...
-
7
Pure CSS Bootstrap Accordion September 29, 2018 CSS only toggle
-
5
Pure CSS Bootstrap Modal September 25, 2018 CSS only toggle
-
4
Pure CSS Bootstrap Collapse September 28, 2018 CSS only toggle
-
7
Bootstrap 3 Grid 笔记 Oct 30, 2013 作为非专业的前端开发,Bootstrap 真是个好东西,特别适合做运营、管理系统界面。这些系统界面要求不高,干净整齐就好,最主要的就是网格 Grid 的使用,简单记录一下。
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK