HTML Element: tr
Read Time:
1 min
The <tr>
element (“table row”) represents a row in a <table>
. The <td>
and <th>
elements are then used within the row to construct table cells.
Example
Syntax
1 |
<table>
|
2 |
<tr>
|
3 |
<th>Name</th> |
4 |
<th>Surname</th> |
5 |
<th>Occupation</th> |
6 |
</tr>
|
7 |
<tr>
|
8 |
<td>Jane</td> |
9 |
<td>Doe</td> |
10 |
<td>Web Developer</td> |
11 |
</tr>
|
12 |
</table>
|
Result
In order to display a border around the
<tr>
elements above, we’ve had to use the unusual CSS border-collapse
property. Read more in the official spec.Browser Support
The <tr>
tag is supported in all modern browsers as well as many email clients. Read more on caniuse.com.
Attributes
The <tr>
tag supports Global Attributes in HTML. Global Attributes are common to all HTML elements and can be used on all of them (though they may not have much of an effect on some of them).
Content
The only elements which can be directly nested within a <tr>
element are <td>
or <th>
elements.
Learn More
Did you know? 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.HTML Elements
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Web Design tutorials. Never miss out on learning about the next big thing.
Sign upI write, teach, and love learning all things web. While I specialize in product design I’m a man of many hats who has worked with mom and pop shops to fortune 500 corporations.
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.