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?
@Leniel this method is good but you need to add width to all the floating div's. I would say make them equal width or assign fixed width. Something like
you may assign class names to each div rather than adding
inline style
, which is not a good practice.Be sure to use a clearfix div or clear div to avoid following content remains below these div's.
You can find details of how to use clearfix div here
It is same way as you do for the two divs, just float the third one to left or right too.
that code that someone posted up there, it did the trick!!! when i paste it just before closing the Container DIV, it helps clear all subsequent DIVs from overlapping with the DIVs i've created side-by-side at the top!
tadaa!! :)
The modern way is to use the CSS flexbox, see support tables.
You can also use CSS grid, see support tables.
you can float: left for all of them and set the width to 33.333%
But does it work in Chrome?
Float each div and set clear;both for the row. No need to set widths if you dont want to. Works in Chrome 41,Firefox 37, IE 11
Click for JS Fiddle
HTML
CSS