Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make div stack first vertically then horizontally? [duplicate]

Possible Duplicate:
How to stack divs from top to bottom in CSS

When i have multiple adjacent divs with float:left, they stack like this:

 _______
| 1 2 3 |
| 4 5   |
|_______|

I want a stack like this:

 _______
| 1 4   |
| 2 5   |
|_3_____|

jsFiddle with the horizontal stacking

How can i achieve vertical stacking ?

like image 533
Benjamin Crouzier Avatar asked Sep 06 '11 11:09

Benjamin Crouzier


1 Answers

@ pinouchon; for this type of layout you can use css3 column-count property for this.

CSS:

div#multicolumn1 {
        -moz-column-count: 2;
        -moz-column-gap: 10px;
        -webkit-column-count: 2;
        -webkit-column-gap: 10px;
        column-count: 2;
        column-gap: 10px;

}

Check my example here for more How to stack divs from top to bottom in CSS

read this article for more http://www.quirksmode.org/css/multicolumn.html

like image 84
sandeep Avatar answered Oct 30 '22 08:10

sandeep