Contents
HTML tr: Main Tips
- HTML table rows are defined with
<tr>
tags. <tr>
can contain any number of table header (<th>) or table data (<td>) elements.- This tag supports global attributes.
Defining HTML Table Rows
HTML tr
tag defines a row in a data table:
<table>
<tr>
<th>Destination A</th>
<th>Destination B</th>
</tr>
<tr>
<td>Lithuania</td>
<td>Germany</td>
</tr>
</table>
You may skip the ending tag if your <tr>
element is followed by another <tr>
element immediately, or if this is the last HTML table row in its parent element.
- Easy to use with a learn-by-doing approach
- Offers quality content
- Gamified in-browser coding experience
- The price matches the quality
- Suitable for learners ranging from beginner to advanced
- Free certificates of completion
- Focused on data science skills
- Flexible learning timetable
- Simplistic design (no unnecessary information)
- High-quality courses (even the free ones)
- Variety of features
- Nanodegree programs
- Suitable for enterprises
- Paid Certificates of completion
- A wide range of learning programs
- University-level courses
- Easy to navigate
- Verified certificates
- Free learning track available
- University-level courses
- Suitable for enterprises
- Verified certificates of completion
Deprecated tr Tag Attributes
There were five attributes commonly used with the HTML tr
tag. However, they were all deprecated in HTML5. To achieve the same results now, you can use various CSS styling properties.
align
set the alignment of all content in a table row:
<tr align="right">
<td>Destination A</td>
<td>Destination B</td>
</tr>
Note: instead of align, use the CSS text-align property.
valign
defined the alignment of the content of table row as vertical:
<tr valign="middle">
<th>Destination A</th>
<th>Destination B</th>
</tr>
Note: instead of valign, use the CSS vertical-align property.
char
aligned the content in a table row to a character:
<tr align="char" char=".">
<td>Germany</td>
<td>Lithuania</td>
</tr>
charoff
set the number of characters for aligning the content after the character specified by the char
attribute:
<tr align="char" char="." charoff="2">
<td>Germany</td>
<td>Lithuania</td>
</tr>
bgcolor
defined a background colour for a table row:
<tr bgcolor="cornsilk">
<th>Destination A</th>
<th>Destination B</th>
</tr>
Note: instead of bgcolor, use the CSS background-color property.