If this is the correct table format, it is advisable to use an html table. If this is not a true table layout, here is what you need in your CSS if you want to keep the HTML intact:
.small {float:left; clear: both;} .left {float:left: clear: both;} .right {float:left;}
"clear: both" looks like a carriage return (ding! for all of you with typewriter memory); "float: left" places material horizontally next to each other instead of stacking boxes (such as divs) vertically.
For my own CSS tabular layouts, I use only two classes: row and column, as follows:
.row>*, .column { float: left; } .row>*:first-child, .column:first-child { clear: both; float: left; } .row, .column>* { clear: both; float: left; }
Here is how I would do your little example:
<div class="row"> <div>left1</div> <div>right1</div> </div> <div class="row"> <div>left2</div> <div>right2</div> </div>
Feel free to ask any comments about the nuances of CSS markup and what it does.
source share