Code has been added to clipboard!

HTML tr Tag

Reading time 2 min
Published Jun 29, 2017
Updated Oct 15, 2019

HTML tr: Main Tips

Defining HTML Table Rows

HTML tr tag defines a row in a data table:

Example
<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.

Udacity
Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid certificates of completion
Coursera
Pros
  • Professional service
  • Flexible timetables
  • A variety of features to choose from
Main Features
  • Professional certificates of completion
  • University-level courses
  • Multiple Online degree programs
Datacamp
Pros
  • Great user experience
  • Offers quality content
  • Very transparent with their pricing
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable

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:

Example
<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:

Example
<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:

Example
<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:

Example
<tr align="char" char="." charoff="2">
  <td>Germany</td>
  <td>Lithuania</td>
</tr>

bgcolor defined a background colour for a table row:

Example
<tr bgcolor="cornsilk">
  <th>Destination A</th>
  <th>Destination B</th>
</tr>

Note: instead of bgcolor, use the CSS background-color property.

Browser support

Browser image
Chrome
1+
Browser image
Edge
All
Browser image
Firefox
1+
Browser image
IE
All
Browser image
Opera
All
Browser image
Safari
All

Mobile browser support

Browser image
Chrome
All
Browser image
Firefox
4+
Browser image
Opera
All
Browser image
Safari
All

Latest Udacity Coupon Found:

Verified STAFF PICK

75% OFF COURSES

Udacity Black Friday Offer

The best time to save on Udacity courses is now - follow this coupon to access a 75% Udacity Black Friday discount & enjoy learning at a very low cost!

Expiration date: 27/02/2021
3176 People Used
Only 97 Left
Rating
5.0