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">&copy; 2025 My Website</td>
  </tr>
</table>

Output in the browser:

Output in the browser
My Website
Home
About
Contact
Main Content
This is the main area of the page.
© 2025 My Website

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, cellpadding and cellspacing are 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
Interview Questions & Answers
What are semantic elements in HTML5? Give examples
What is the difference between div and section in HTML?
How do you make a web page responsive using HTML and CSS?
What is web accessibility and how does HTML help with it?