How to design Grid system with bootstrap?
In large and medium display it will show 2 columns and 3 rows. First column will have 1 cell and second columns will have 3 cells.
In small and extra small display it will show only 1 column and 4 rows. Each cell will stack one after another in a single column. First column/cell from large or medium display should come first here.
The Bootstrap 3 grid system has four tiers of classes: xs (phones), sm (tablets), md (desktops), and lg (larger desktops). You can use nearly any combination of these classes to create more dynamic and flexible layouts.
You can get the 5 colums to wrap within the same . row using a clearfix break such as <div class="col-12"></div> or <div class="w-100"></div> every 5 columns. As of Bootstrap 4.4, you can also use the row-cols-5 class on the row ... Save this answer.
Simply use col-sm-12 .
Try this:
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
First Column, First Cell
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
Second Column, First Cell
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
Second Column, Second Cell
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
Second Column, Third Cell
</div>
</div>
</div>
Jake745 answer is right somehow but miss out the "row" div for the nested column. You can't have a column without a row so it is good to maintain that structure. Also, you don't need to repeat the column if you required all screen size to be spread to 12 or whatever size. ie, if you required mobile to take up 12 column while tablet onwards take up 6 columns, you just need to put "col-xs-12 col-sm-6" and anything above sm will always take up 6 columns automatically.
This way, you will reduce your code and not put in unnecessary codes. Hope this help.
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-6">
First Column, First Cell
</div>
<div class="col-xs-12 col-sm-12 col-md-6">
<div class="row">
<div class="col-xs-12">
Second Column, First Cell
</div>
<div class="col-xs-12">
Second Column, Second Cell
</div>
<div class="col-xs-12">
Second Column, Third Cell
</div>
</div>
</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With