HTML <tr> Tag
Description
The <tr>
HTML tag, short for "table row," is used to define a row within an HTML table. Tables are a fundamental component of web development, allowing for the organized presentation of data in rows and columns. Each <tr>
element typically contains one or more <td>
(table data) or <th>
(table header) elements, which represent individual cells within the row. <td>
elements contain regular data, while <th>
elements are used for header cells that label or describe the data in the row. By using the <tr>
tag, web developers can structure and arrange information in a tabular format, making it easier for users to comprehend and navigate data sets on a webpage.
Properties
- Permitted Parents
- <table> (only if the table has no child <tbody> element, and even then only after any <caption>, <colgroup>, and <thead> elements); otherwise, the parent must be <thead>, <tbody> or <tfoot>
- Content
- <th>, <td>
- Start/End Tags
- Start tag: optional, End tag: optional
Example
<table border="1">
<tr>
<td>Cat</td>
<td>Dog</td>
</tr>
<tr>
<td>Mouse</td>
<td>Bird</td>
</tr>
</table>
Attributes
NoneGlobal Attributes
The <tr>
tag also supports the Global Attributes in HTML5
Event Attributes
The <tr>
tag also supports the Event Attributes in HTML5
Browser Support
The following table will show you the current browser support for the HTML <tr>
tag.
Desktop | |||||
12 | 1 | 1 | 12.1 | 1 |
Tablets / Mobile | |||||
18 | 4 | 12.1 | 1 | 1 | 4.4 |
Last updated by CSSPortal on: 30th March 2024