Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap responsive columns order based on alphabetical content

Let's say I have 4 columns like this

A   D   G   J
B   E   H   K
C   F   I   L

I just can't get my head around the markup that's needed to let it flow like this:

A   G
B   H
C   I
D   J
E   K
F   L

Instead of

A   D
B   E
C   F
G   J
H   K
I   L

Any information regarding this issue would be much appreciated!

like image 886
Mario Van den Eynde Avatar asked Jul 23 '14 14:07

Mario Van den Eynde


3 Answers

You should be able to do this with:

<div class="col-xs-6 col-md-3">A<br>B<br>C</div>
<div class="col-xs-6 col-md-3 col-md-push-3">G<br>H<br>I</div>
<div class="col-xs-6 col-md-3 col-md-pull-3">D<br>E<br>F</div>
<div class="col-xs-6 col-md-3">J<br>K<br>L</div>

I find designing from the smallest size first make this easy.

bootply example

like image 186
j08691 Avatar answered Nov 15 '22 17:11

j08691


Assuming you are using bootstrap 3. I have achieved the effect I think you are after by nesting columns:

<div class="col-sm-6">
 <div class="col-md-6">A <br/> B <br/> C</div>
 <div class="col-md-6">D <br/> E <br/> F</div>
</div>
<div class="col-sm-6"> 
  <div class="col-md-6">G <br/> H <br/> I</div>
  <div class="col-md-3">J <br/> K <br/> L</div>
</div>

Demo

like image 26
Zac Avatar answered Nov 15 '22 18:11

Zac


You can try something like this. Note - this is 2 columns at less than 768px and 4 at 768px and up.

Demo here

<div class="row">
    <div class="col-xs-6">
        <div class="col-xs-12 col-sm-6">
            <div>A</div>
            <div>B</div>
            <div>C</div>
        </div>
        <div class="col-xs-12 col-sm-6">
            <div>D</div>
            <div>E</div>
            <div>F</div>
        </div>
    </div>
    <div class="col-xs-6">
        <div class="col-xs-12 col-sm-6">
            <div>G</div>
            <div>H</div>
            <div>I</div>
        </div>
        <div class="col-xs-12 col-sm-6">
            <div>J</div>
            <div>K</div>
            <div>L</div>
        </div>
    </div>
</div>
like image 1
Tricky12 Avatar answered Nov 15 '22 18:11

Tricky12