How To Vertically Divide A Web Page Without Using A Table?

Jan Tacci picture Jan Tacci · Nov 8, 2012 · Viewed 33.7k times · Source

I read somewhere (on Stack Overflow as a matter of fact!) that it's a bad idea to use tables to layout pages in html.

I have an HTML page that needs to be "divided" down the middle with some content going on the left and some content going on the right. At fist I would have thought to use nested tables with each of their widths being 50%. Can I do the same thing using div? Or some other html construct?

Answer

Akhil picture Akhil · Nov 8, 2012
<div style="float:left; width:50%;">
Left  <!-- Set Div As your requirement -->
</div>
<div style="float:left; width:50%;">
Right  <!-- Set Div As your requirement -->
</div>