KandZ – Tuts

We like to help…!

HTML 11 – tables

table, tr, th, td and caption elements

<table>
  <caption>Product list</caption>
  <tr>
    <th colspan="2">Product Name</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>Product A</td>
    <td>Product A</td>
    <td>$10.99</td>
  </tr>
  <tr>
    <td>Product B</td>
    <td>Product B</td>
    <td>$25.49</td>
  </tr>
</table>
  • Tables in HTML are used to display tabular data
  • such as list of products, calendars, list of customers etc.
  • table element defines a table
  • a table contains rows
  • table rows contain cells
  • table rows can also contain table headers that define the header titles
  • table headers can also be vertical by puting them on the first cell of each row
  • colspan attribute spawns the column over two or more columns
  • rowspan attribute spans a cell over two or more columns
  • caption element adds a heading for the whole table and should be added after <table> tag

Leave a Reply