This page is Not Ready

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

table

Summary

The <table> element is a wrapper for an HTML table. It defines the start and end of a table, and can contain other table elements, such as <tr>.

Overview Table

DOM Interface
HTMLTableElement

The <table> element is a container for HTML table data, which is used to mark up tabular data. Tabular data is any data that can be systematically displayed in rows and columns, for example, “See table 3 for an example.”

Tables were often used for laying out web pages because tables helped fix the position of text on the page, however, this use has become an outdated. We recommend you use <div> and <span> for fixed layouts. You can still use tables for tabular data.

You might find working with an HTML table editor easier than coding tables by hand, unless you are especially adept at visualizing table row and columns using the appropriate HTML tags. It is easy to miss or drop a tag when coding tables manually, which will cause your table to be malformed.

Examples

This example uses the tbody element with the ****table****, td, thead, and tr elements to create a table with the first row in the table head and the second row in the table body.

<table>
  <thead>
    <tr>
      <td>
        This text is in the thead.
      </td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        This text is in the tbody.
      </td>
    </tr>
  </tbody>
</table>

Usage

 At the most simple level you need to use the following three groups of tags to create a basic table.
tag begins the table, and \ tag ends the table. 2\> \ creates a row while ends the row. 3\> ends the column space. These are usually nested inside a pair of tags. The term "td" stands for table data, but as a representation, you can view it like a "column tag".

The three pairs of tags can create a simple two row, two column table using the code below.

||
|row 1 col 1|row 1 col 2|
|row 1 col 2|row 2 col 2|

Related specifications

HTML 5.1
W3C Working Draft
HTML 5
W3C Recommendation
HTML 4.01
W3C Recommendation

See also

Related articles

HTML

Tables

creates a column space while