by prettyscripts on 2008-05-23 12:22:59 • Leave a comment »
a table layout can be achieved without <table> in html, with <div> and css.
CSS:
{ width: 200px; float: left; } |
Code:
<div> | |
<div class="col">row 1, col 1</div> | |
<div class="col">row 1, col 2</div> | |
</div> | |
<div style="clear: both;"> | |
<div class="col">row 2, col 1</div> | |
<div class="col">row 2, col 2</div> | |
</div> | |
<div style="clear: both;"></div> |
do not use <span> to define table cell.
according to specification, width property does not apply to in-line elements, which includes <span>.