HTML tr Tag Tutorial

In this section, we will learn what HTML <tr> element is and how to use it.

Table Row: What is <tr> Tag in HTML?

HTML <tr> element stands for Table Row and is used when we want to create a row on a table.

Inside the body of this element, we can put other HTML elements that are used to create table cells.

For example, to create a cell in a table, we can use either HTML <td> or <th> element. These elements are smaller part in a table row and so we put them in an HTML <tr> element to be grouped into other cells of the same row.

HTML <tr> Tag Syntax:

<tr>

<th> </th> <td> </td> …

</tr>

Example: HTML table row

See the Pen HTML table row by Omid Dehghan (@odehghan) on CodePen.

HTML Table Background Color

Using CSS, we can modify the default style of a table as a whole or each row or cell if we want to be more specific and style each individual separately.

For example, to change the background color of a table, we can use the CSS background or background-color property.

Example: background color of table in HTML

See the Pen background color of table in HTML by Omid Dehghan (@odehghan) on CodePen.

Facebook
Twitter
Pinterest
LinkedIn

Top Technologies