Home > Abakada: Back to Basics > Language References > HTML Elements > TR Element
Denotes a row in a table. | HTML 3.2, 4, 4.01, 5 |
HTML Syntax
<tr
class = classname
id = value
style = css_style_rules
title = text
>
The <tr
> element specifies a table row.
tr elements can only be used within a <table> element.
Each tr element can contain <th> elements, which indicate table headings, and <td> elements, which indicate the table data cells.
Although the W3C specifies that tr end tags are optional and may be omitted, it is safer to always close table rows, as not all browsers support this recommendation, and may produce unexpected results.
A <tr
> element’s end tag can be omitted if the <tr
> element is immediately followed by another <tr
> element, or if there is no more content in the parent element.
The <tr>
element has no attribute of its own, but supports global attributes common to all HTML elements.
The following shows how the tr element may be used.
<table>
<tr><th>This is the header row.</th></tr>
<tr><td>This is the first row.</td></tr>
<tr><td>This is the second row.</td></tr>
</table>
TABLE TD TH Using Tables