HTML Element: tr

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.


This content originally appeared on Envato Tuts+ Tutorials and was authored by Andy Leverenz

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.


This content originally appeared on Envato Tuts+ Tutorials and was authored by Andy Leverenz


Print Share Comment Cite Upload Translate Updates
APA

Andy Leverenz | Sciencx (2023-02-10T12:46:24+00:00) HTML Element: tr. Retrieved from https://www.scien.cx/2023/02/10/html-element-tr/

MLA
" » HTML Element: tr." Andy Leverenz | Sciencx - Friday February 10, 2023, https://www.scien.cx/2023/02/10/html-element-tr/
HARVARD
Andy Leverenz | Sciencx Friday February 10, 2023 » HTML Element: tr., viewed ,<https://www.scien.cx/2023/02/10/html-element-tr/>
VANCOUVER
Andy Leverenz | Sciencx - » HTML Element: tr. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/02/10/html-element-tr/
CHICAGO
" » HTML Element: tr." Andy Leverenz | Sciencx - Accessed . https://www.scien.cx/2023/02/10/html-element-tr/
IEEE
" » HTML Element: tr." Andy Leverenz | Sciencx [Online]. Available: https://www.scien.cx/2023/02/10/html-element-tr/. [Accessed: ]
rf:citation
» HTML Element: tr | Andy Leverenz | Sciencx | https://www.scien.cx/2023/02/10/html-element-tr/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.