The Table feature allows the user to create data table.
The <figure>
element MUST be used to represent the Table feature as it is the standard way to express self-contained non-textual additional content[1].
The <figure>
element SHOULD have a class
attribute which value is set to table
to identify that the element is being used for representing table and to allow styling that particular use-case.
The <table>
element MUST be used to represent the table itself as it is the standard way to express a table in HTML[2].
The <table>
SHOULD have a header placed inside <thead>
element[3]. If the <thead>
element is not present, the first row of the table MUST represent the header[4]. The header MUST contain a row with headings for each column, represented by <tr>
element with <th>
elements inside[5, 6]. The <th>
elements MAY have scope
attribute with value set to col
[7].
The contents of the table SHOULD be placed inside <tbody>
element[8]. The content MUST be divided into rows, represented by <tr>
elements, and rows MUST be divided into cells, represented by <td>
elements[4, 9]. Rows MAY contain also headings, represented by <th>
elements with scope
attribute with value set to row
[7].
The caption for the table, if it is present, MUST be placed inside <figcaption>
element[10].
Example:
<figure class="table">
<table>
<thead>
<tr>
<th scope="col">Person</th>
<th scope="col">Position</th>
</tr>
</thead>
<tbody>
<tr>
<td>John Smith</td>
<td>JS developer</td>
</tr>
<tr>
<td>John Doe</td>
<td>Java developer</td>
</tr>
<tr>
<td>John DeFoe</td>
<td>ASP .NET developer</td>
</tr>
</tbody>
</table>
<figcaption>Company's most valuable employees</figcaption>
</figure>
<figure>
element definition in the HTML5 standard.<table>
element definition in the HTML5 standard.<thead>
element definition in the HTML5 standard.<tr>
element definition in the HTML5 standard.<th>
element definition in the HTML5 standard.scope
attribute definition in the HTML5 standard.<tbody>
element definition in the HTML5 standard.<td>
element definition in the HTML5 standard.<figcaption>
element definition in the HTML5 standard.