I know how to make 2 divs float side by side, simply float one to the left and the other to the right.
But how to do this with 3 divs or should I just use tables for this purpose?
I know how to make 2 divs float side by side, simply float one to the left and the other to the right.
But how to do this with 3 divs or should I just use tables for this purpose?
I prefer this method, floats are poorly supported in older versions of IE (really?...)
UPDATED : Of course, to use this technique and due to the absolute positioning you need to enclose the divs on a container and do a postprocessing to define the height of if, something like this:
Not the most amazing thing in the world, but at least doesn't break on older IEs.
try to add "display: block" to the style
the advantage of this way is you can set each column width independant of the other as long as you keep it under 100%, if you use 3 x 30% the remaining 10% is split as a 5% divider space between the collumns
float them all left
make sure a width is specified that they can all fit in their container (either another div or the window), otherwise they will wrap
I usually just float the first to the left, the second to the right. The third automatically aligns between them then.
Here's how I managed to do something similar to this inside a
<footer>
element:CSS: