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.

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

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

Mobile browser support

Chrome
All
Firefox
4+
Opera
All
Safari
All
Basics
Introduction
Syntax
Editors
Basic Examples
Head Section
<!DOCTYPE>
Tags and Elements
Semantic Elements
Tags Reference
Attributes
Comments
Block and Inline Elements
Forms
Form Elements
Input
Responsive Web Design
Inline Scripts
Uniform Resource Locator
Redirect
XHTML
Geolocation
Drag and Drop
Local Storage
Web Workers
Server-Sent Events
Character Encoding
Text Formatting
Quotation and Citation Elements
Headings
Paragraphs
Links
Tables
Lists
Symbols
Space
Tab
Styles
Computer Code
Layout
Classes
Colors
Images
iframes
Audio Player
Video Player
YouTube Videos
Multimedia
Canvas
SVG
<!-- -->
<a>
<abbr>
<acronym> DEPRECATED
<address>
<applet> DEPRECATED
<article>
<aside>
<audio>
<b>
<base>
<basefont> DEPRECATED
<bdi>
<bdo>
<big> DEPRECATED
<blink> DEPRECATED
<blockquote>
<body>
<br>
<button>
<canvas>
<caption>
<center> DEPRECATED
<cite>
<code>
<col>
<colgroup>
<datalist>
<dd>
<del>
<details>
<dfn>
<dialog>
<dir> DEPRECATED
<div>
<dl>
<dt>
<em>
<embed>
<fieldset>
<figcaption>
<figure>
<font> DEPRECATED
<footer>
<form>
<frame> DEPRECATED
<frameset> DEPRECATED
<h1> – <h6>
<head>
<header>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<kbd>
<keygen> DEPRECATED
<label>
<legend>
<li>
<link>
<main>
<map>
<mark>
<menu>
<menuitem> DEPRECATED
<meta>
<meter>
<nav>
<noframes> DEPRECATED
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike> DEPRECATED
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt> DEPRECATED
<u>
<ul>
<var>
<video>
<wbr>