HTML Tables


Tables are defined with the <table> tag. A table is divided into rows (with the <tr> tag), and each row is divided into data cells (with the <td> tag). A data cell can contain text, images, lists, forms, horizontal rules, tables, etc.

HTML Script Web Display
 <table border="1">
  <tr>
   <th>Heading</th>
   <th>Another Heading</th>
  </tr>
  <tr>
   <td>row 1, cell 1</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td> </td>
   <td>row 2, cell 2</td>
  </tr>
 </table>
Heading Another Heading
row 1, cell 1  
row 2, cell 2

The following comments are related to the above example:
Tag Description Tag Description
<table> Defines a table. <th> Defines a table header.
<tr> Defines a table row. <td> Defines a table cell.
<caption> Defines a table caption. <thead> Defines a table head.
<col> Defines the attribute values for one or more columns in a table. <colgroup> Defines groups of table columns.
<tbody> Defines a table body. <tfoot> Defines a table footer.


Demonstration
The following demonstration shows how the HTML script is displayed on the Web.

     




Review: HTML Tables
    Which tag does NOT exist for the HTML table creation?

      tc
      td
      th
      tr
        Result: