HTML Tables

Creating Tables

Use <table>, with rows defined by <tr> and cells by <td> or headers by <th>.

Table Attributes

  • border: Sets table border width
  • cellpadding: Sets cell padding
  • cellspacing: Sets space between cells

Example Table Structure

<table border="1" cellpadding="8" cellspacing="0">
  <tr>
    <th>Name</th><th>Age</th><th>City</th>
  </tr>
  <tr>
    <td>Alice</td><td>25</td><td>New York</td>
  </tr>
</table>