Basic HTML Page layout using table tag
Before CSS was common, developers used <table> tags to place the header, menu, content and footer on a page. This is called a table layout. It still works, but it is not recommended today. This example is for learning and for understanding old websites.
Note:
Tables are made to show data, not to design pages. Table layouts are hard to change, slow on phones and bad for screen readers. For new pages use the div and Flexbox layout.
Table layout code
<table width="100%" cellspacing="0" cellpadding="10" border="1">
<tr>
<td colspan="2" align="center"><h1>My Website</h1></td>
</tr>
<tr>
<td width="25%" valign="top">
<a href="#">Home</a><br>
<a href="#">About</a><br>
<a href="#">Contact</a>
</td>
<td valign="top">
<h2>Main Content</h2>
<p>This is the main area of the page.</p>
</td>
</tr>
<tr>
<td colspan="2" align="center">© 2025 My Website</td>
</tr>
</table>
Output in the browser:
Output in the browser
How it works
- The first row has one cell that covers both columns (
colspan="2") for the header. - The second row has the menu on the left and the content on the right.
- The last row is the footer.
- Attributes like
width,align,valign,border,cellpaddingandcellspacingare old. In new code use CSS.
Learn more about tables in HTML Tables.
Learn more about the similar topics:
| Tutorials |
|---|
| HTML Semantic Elements |
| HTML Responsive Design |
| Exercises & Assignments |
|---|
| Write an HTML program to create a navigation menu |
| Write an HTML program to create a page layout with semantic elements |