Breaking

Sunday, May 12, 2019

HTML tr Tag

and two rows:
<table>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
Try it Yourself »
More "Try it Yourself" examples below.

Definition and Usage

The <tr> tag defines a row in an HTML table.
A <tr> element contains one or more <th> or <td>elements.

Browser Support

Element
<tr>YesYesYesYesYes

Differences Between HTML 4.01 and HTML5

All the layout attributes are removed in HTML5.


Attributes

AttributeValueDescription
alignright
left
center
justify
char
Not supported in HTML5.
Aligns the content in a table row
bgcolorrgb(x,x,x)
#xxxxxx
colorname
Not supported in HTML5.
Specifies a background color for a table row
charcharacterNot supported in HTML5.
Aligns the content in a table row to a character
charoffnumberNot supported in HTML5.
Sets the number of characters the content will be aligned from the character specified by the char attribute
valigntop
middle
bottom
baseline
Not supported in HTML5.
Vertical aligns the content in a table row

Global Attributes

The <tr> tag also supports the Global Attributes in HTML.

Event Attributes

The <tr> tag also supports the Event Attributes in HTML.

Try it Yourself - Examples

Table headers
How to create table headers.
Table with a caption
An HTML table with a caption.
Tags inside a table
How to display elements inside other elements.
Cells that span more than one row/column
How to define table cells that span more than one row or one column.

Related Pages

HTML tutorial: HTML Tables
HTML DOM reference: TableRow object
CSS Tutorial: Styling Tables

Default CSS Settings

Most browsers will display the <tr> element with the following default values:
tr {
  display: table-row;
  vertical-align: inherit;
  border-color: inherit;
}

No comments:

Post a Comment