Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to design rowspan using bootstrap div?

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.

like image 483
Mousam Avatar asked Sep 04 '14 16:09

Mousam


People also ask

What is XS SM MD lg in Bootstrap?

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.

How do I make 5 equal columns in Bootstrap?

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.

How do I merge two columns in Bootstrap?

Simply use col-sm-12 .


2 Answers

Try this:

DEMO

       <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>
like image 131
Suganth G Avatar answered Sep 29 '22 17:09

Suganth G


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>
like image 38
StrangeLove Avatar answered Sep 29 '22 17:09

StrangeLove