CSS Float Examples

Examples on different float behaviour with CSS in 'styles-examples.css'.

Basic Boxes

box 1
box 2
box 3

Boxes: float left

Need clearfix on container to hold floats.

Float box1

box 1
box 2
box 3

Float box1 & box2

box 1
box 2
box 3

Float box1, box2, box3

box 1
box 2
box 3

Boxes: Float Right

'clear: left' needed on text above to avoid flowing text in-line with previous floated div.

Float box1 right

box 1
box 2
box 3

Float box1, box2 right

box 1
box 2
box 3

Float box1, box2, box3 right

box 1
box 2
box 3

Float box1, box2 right, box3 beside box2

Add 'clear: right' to text above to avoid float beside previous divs.
box 1
box 2
box 3

Float box1, box2, box3 stacked on right

Add 'clear: right' to text to avoid float beside previous divs.
box 1
box 2
box 3

Any text that comes after will be placed to left. And it will wrap around the boxes floating on the right. As much text as there is all the way down. Now worries, no challenges, no struggle. Will just continue on flowing.

Even if multiple paragraphs - no problemo!

Float boxes across page

Spread out across page evenly

box 1
box 2
box 3