HTML <th> align Attribute Last Updated : 25 Sep, 2024 Comments Improve Suggest changes Like Article Like Report The HTML <th> align Attribute is used to set the horizontal alignment of text content inside the table header cell. Instead, use CSS for alignment properties such as text-align to specify the horizontal alignment and vertical-align for vertical alignment within table headers.Note: The align attribute is not supported by HTML5. Syntax:<th align= "left | right | center | justify | char"> Attribute Values:Attribute ValuesDescriptionleftIt sets the text left-aligned.rightIt sets the text right-align.centerIt sets the text center-align.justifyIt stretches the text of paragraph to set the width of all lines equal.charIt sets the text-align to a specific character.Example: The implementation of the align attribute html <!DOCTYPE html> <html> <head> <title> HTML th align Attribute </title> </head> <body> <h1>GeeksforGeeks</h1> <h2>HTML th align Attribute</h2> <table width="300" border="1"> <tr> <th align="left">NAME</th> <th align="center">AGE</th> <th align="right">BRANCH</th> </tr> <tr> <td>BITTU</td> <td>22</td> <td>CSE</td> </tr> <tr> <td>RAKESH</td> <td>25</td> <td>EC</td> </tr> </table> </body> </html> Output:Using CSS Instead of the align AttributeIn modern HTML5, it's recommended to use CSS to manage text alignment in table headers. The text-align property can handle horizontal alignment, while the vertical-align property controls vertical alignment. Example: Here’s how you can replace the deprecated align attribute with CSS: HTML <!DOCTYPE html> <html> <head> <title>Modern CSS Alignment Example</title> <style> /* CSS for table header alignment */ th.left-align { text-align: left; } th.center-align { text-align: center; } th.right-align { text-align: right; } </style> </head> <body> <table border="1"> <tr> <th class="left-align">Left Aligned Header</th> <th class="center-align">Center Aligned Header</th> <th class="right-align">Right Aligned Header</th> </tr> <tr> <td>Row 1, Cell 1</td> <td>Row 1, Cell 2</td> <td>Row 1, Cell 3</td> </tr> </table> </body> </html> Output: Using CSS Instead of the align AttributeSupported Browsers:Google Chrome 1 Microsoft Edge 12Firefox 1 Opera 12.1Safari 1 Comment More infoAdvertise with us Next Article HTML <th> align Attribute J jit_t Follow Improve Article Tags : Web Technologies HTML HTML-Attributes Similar Reads HTML <td> align Attribute In HTML, the <td> (table data) element is used to define an individual cell within a table row (<tr>). It plays a crucial role in organizing and presenting structured data clearly. Whether displaying numerical values, text, or percentagesâsuch as 85% for progress or success ratesâthe 2 min read HTML <tr> align Attribute 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> el 1 min read HTML | <thead> align Attribute The HTML <thead> align attribute is used to set the horizontal alignment of text content inside the table head (thead) section. Syntax: <thead align="left|right|center|justify|char"> Note: This attribute has been DEPRECATED and is no longer recommended. Attribute Value: left: It sets the 1 min read HTML <p> align Attribute The align attribute in the HTML <p> tag is used to control the alignment of paragraph text. It allows you to align text to the left, center, or right of its container. This attribute helps in adjusting the text layout for better presentation and readability. Syntax:<p align="left | right | 4 min read HTML | <tbody> align Attribute The HTML <tbody> align Attribute is used to set the horizontal alignment of text content inside the table body (tbody). Syntax: <tbody align="left | right | center | justify | char"> Attribute Value: left: It sets the text left-align. right: It sets the text right-align. center: It sets 1 min read Like