Language
日本語
English

Caution

JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.

  1. Home
  2. HTML Tag Dictionary
  3. <table> / <tr> / <td> / <th>

<table> / <tr> / <td> / <th>

The <table> element creates a table in HTML. Use <tr> to define rows, <td> for data cells, and <th> for header cells.

Syntax

<table>
  <tr>
    <th>Header 1</th>
    <th>Header 2</th>
  </tr>
  <tr>
    <td>Data 1</td>
    <td>Data 2</td>
  </tr>
</table>

Tags and Attributes

Tag / AttributeDescription
<table>The container element that wraps the entire table.
<tr>Represents a table row (Table Row).
<td>Represents a table data cell (Table Data). Used for regular content.
<th>Represents a table header cell (Table Header). Text is bold and centered by default.
scopeSpecifies which cells a <th> header relates to. Accepted values are col (column), row (row), colgroup, and rowgroup.

Sample Code

<table border="1">
  <tr>
    <!-- scope="col" marks these as column headers -->
    <th scope="col">Name</th>
    <th scope="col">Language</th>
    <th scope="col">Purpose</th>
  </tr>
  <tr>
    <td>HTML</td>
    <td>Markup language</td>
    <td>Web page structure</td>
  </tr>
  <tr>
    <td>CSS</td>
    <td>Stylesheet language</td>
    <td>Web page appearance</td>
  </tr>
  <tr>
    <td>JavaScript</td>
    <td>Programming language</td>
    <td>Web page behavior</td>
  </tr>
</table>

Result

A table with 3 columns and 4 rows is displayed. The first row contains bold headers (Name, Language, Purpose), and rows 2–4 contain the data for each language.

HTML Render Preview
Name Language Purpose HTML Markup language Web page structure CSS Stylesheet language Web page appearance JavaScript Programming language Web page behavior

Notes

HTML tables are intended for displaying **tabular data**. In the past, tables were often used for page layout, but today the correct approach is to use CSS Flexbox or Grid. Use tables only for presenting data.

Adding the scope attribute to <th> elements explicitly tells assistive technologies such as screen readers which row or column the header applies to. Use scope="col" for column headers and scope="row" for row headers to improve accessibility.

For elements that give a table more semantic structure — <thead>, <tbody>, <tfoot>, and <caption> — see 'thead / tbody / tfoot / caption'. For merging cells, see 'colspan / rowspan'.

Browser Support

Chrome Chrome
49+
Supported in all versions
Firefox Firefox
57+
Supported in all versions
Safari Safari
18+
Supported in all versions
Edge Edge
80+
11 or earlier ×
IE IE
11 or earlier ×
Opera Opera
48 or earlier ×
iOS Safari iOS Safari
18+
Supported in all versions
Android Browser Android Browser
37+
4 or earlier ×
Chrome Android Chrome Android
36+
17 or earlier ×
Firefox Android Firefox Android
79+
3 or earlier ×

If you find any errors or copyright issues, please .