marines
marines

Reputation: 2693

Float divs to both sides

Let's say I have a bunch of divs which have either "left" class or "right" class. Is it possible to make these divs to float on both sides of container like there was a column of "left" divs and a column of "right" divs aligned one under another. Order of divs is random.

I'm not looking for two-column-layout. ;)

Upvotes: 2

Views: 3317

Answers (1)

thirtydot
thirtydot

Reputation: 228182

See : http://jsfiddle.net/thirtydot/qdZWh/

div {
    width: 50px;
    height: 50px;
    outline: 1px dashed #666
}
.left {
    float: left;
    clear: left;
    background: yellow
}
.right {
    float: right;
    clear: right;
    background: #0f0
}
<div class="left"></div>
<div class="right"></div>
<div class="left"></div>
<div class="right"></div>

Upvotes: 5

Related Questions