Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML & CSS: Vertical Flow Layout (columnar style), how to implement?

Tags:

html

css

The standard CSS/html positioning of "flowing" Elements is horizontal (row based) => float:left;. What do I need to do, to position them like in the example below (columnar style). Are there any CSS tags to set this somewhere? (Ideally I do not want to setup a grid, this should happen the same way automatically lilke it does in the float:left style...)

+---------------------------+
|  DivBox1                  |
|  DivBox2                  |
|  DivBox3                  |
+---------------------------+

After adding: 2 more boxes:

+----------------------------+
|  DivBox1  DivBox4          |
|  DivBox2  DivBox5          |
|  DivBox3                   |
+----------------------------+

Finally, after adding 2 more boxes it would look like this:

+-----------------------------+
|  DivBox1  DivBox4  DivBox7  |
|  DivBox2  DivBox5           |
|  DivBox3  DivBox6           |
+-----------------------------+
like image 436
user1145216 Avatar asked Feb 02 '12 20:02

user1145216


People also ask

What is HTML used for?

HTML (HyperText Markup Language) is the code that is used to structure a web page and its content. For example, content could be structured within a set of paragraphs, a list of bulleted points, or using images and data tables.

Is HTML coding?

HTML is not a programming language. It's a markup language. In fact, that is the technology's name: HyperText Markup Language.

What is HTML for beginners?

HTML is the standard markup language for Web pages. With HTML you can create your own Website. HTML is easy to learn - You will enjoy it!

Is HTML easy to learn?

HTML is perhaps one of the easiest front-end programming languages to master. So if you want to learn HTML, then go for it! With patience and practice, you'll learn to make the most of this popular language.


1 Answers

There is CSS3 Columns (for the effect you talk about, the Height Balancing section is a good thing to read) which is supported in newer browsers and would look something like

#box {
    column-count: 3;
    -moz-column-count: 3;
    -webkit-column-count: 3;
}

And would support IE 10, FF, and Chrome.

Or, you can use a tool like Masonry.js to get column like effects on a page (though this requires JS to work) and support more browsers.

like image 186
LoveAndCoding Avatar answered Sep 17 '22 17:09

LoveAndCoding