Open In App

HTML <tr> align Attribute

Last Updated : 05 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

The HTML <tr> align Attribute is used to set the horizontal alignment of text content inside the table row. The HTML <tr> element itself doesn’t have an align attribute. For aligning content within a table row, use the CSS text-align property on the individual <td> or <th> elements inside the row.

Note: It is not supported by HTML5.

Syntax:

<tr align= "left | right | center | justify | char">

Attribute Values:

Attribute Values

Description

left

It sets the text left-aligned.

right

It sets the text right-align.

center

It sets the text center-align. It is a default value.

justify

It stretches the text of paragraph to set the width of all lines equal.

char

It sets the text-align to a specific character.

Example : In this example we will see the implementation of <tr> align attribute with an example.

html




<!DOCTYPE html>
<html>
 
<head>
    <title>HTML tr align Attribute</title>
</head>
 
<body>
    <h1>GeeksforGeeks</h1>
    <h2>HTML tr align Attribute</h2>
   
    <table width="500" border="1">
        <tr align="right">
            <th>Name</th>
            <th>Expenses</th>
        </tr>
 
        <tr align="center">
            <td>BITTU</td>
            <td>2500.00</td>
        </tr>
 
        <tr align="left">
            <td>RAKESH</td>
            <td>1400.00</td>
        </tr>
    </table>
</body>
 
</html>


Output:

Supported Browsers:

  • Google Chrome 1
  • Edge 12
  • Firefox 1
  • Safari 12.1
  • Opera 3


Similar Reads

Difference between align-content and align-items
Both align-content and align-items function on the cross-axis.Cross-axis in flexbox is dependent on the flex-direction and runs perpendicular to the main-axis, if flex-direction is either row or row-reverse then the cross-axis is vertical, if flex-direction is either column or column-reverse then the cross-axis is horizontal. align-content align-it
4 min read
HTML | &lt;col&gt; align Attribute
The HTML &lt;col&gt; align Attribute is used to set the horizontal alignment of text content inside the col element. It is not supported by HTML 5. Syntax: &lt;col align="left | right | center | justify | char"&gt; Attribute Values: left: It sets the text left-align. right: It sets the text right-align. center: It sets the text center-align. justif
1 min read
HTML | &lt;tbody&gt; align Attribute
The HTML &lt;tbody&gt; align Attribute is used to set the horizontal alignment of text content inside the table body (tbody). Syntax: &lt;tbody align="left | right | center | justify | char"&gt; Attribute Value: left: It sets the text left-align. right: It sets the text right-align. center: It sets the text center-align. By default, it is set to ce
1 min read
HTML | &lt;tfoot&gt; align Attribute
The HTML &lt;tfoot&gt; align Attribute is used to set the horizontal alignment of text content inside the table footer (tfoot). It is not supported by HTML 5. Syntax: &lt;tfoot align="left | right | center | justify | char"&gt; Attribute Value: left: It sets the table footer text left-align. right: It sets the table footer text right-align. center:
1 min read
HTML | &lt;legend&gt; align Attribute
The &lt;legend&gt; align attribute in HTML is used to specify the alignment of the caption in a &lt;fieldset&gt; element. The left and right alignment of &lt;legend&gt; element are supported by major browsers except Opera 12 and earlier versions. The bottom alignment are not supported by any browsers.Syntax: &lt;legend align="left|right|top|bottom"
2 min read
HTML | &lt;caption&gt; align Attribute
The HTML &lt;caption&gt; align Attribute is used to specify the alignment of the &lt;caption&gt; Element. It is used to align the caption to the left, right, top and Bottom of a table. This attribute is not supported in HTML5. Note: By default , the table caption is aligned to center. Syntax: &lt;caption align="left | right | top | bottom&gt; Attri
2 min read
HTML | &lt;colgroup&gt; align Attribute
The HTML &lt;colgroup&gt; align attribute is used to set the horizontal alignment of the text or content in the group of column. Syntax: &lt;colgroup align="left|right|center|justify|char&gt; Attribute Values: left: It sets the content to the left-align.right: It sets the content to the right-align.center: It sets the content to the center.justify:
1 min read
HTML | &lt;thead&gt; align Attribute
The HTML &lt;thead&gt; align attribute is used to set the horizontal alignment of text content inside the table head (thead) section. Syntax: &lt;thead align="left|right|center|justify|char"&gt; Note: This attribute has been DEPRECATED and is no longer recommended. Attribute Value: left: It sets the text left-align.right: It sets the text right-ali
1 min read
HTML | applet align Attribute
The HTML applet align attribute is used to specify the alignment of the &lt;applet&gt; element or the content present inside the applet element. Note: This attribute is not supported by HTML5. Syntax: &lt;applet align="left | right | center | justify";&gt; Attribute Values: left: It sets the content to the left-align. right: It sets the content to
1 min read
HTML &lt;iframe&gt; align Attribute
The HTML &lt;iframe&gt; align attribute is used to specify the alignment of the inline-frame according to the alternate element. Syntax &lt;iframe align="left|right|middle|top|bottom"&gt; Attribute Values left: It sets the alignment of an iframe to left.right: It sets the alignment of an iframe to right.middle: It sets the alignment of an iframe to
1 min read