Last Updated : 12 Jul, 2025
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 <td>
tag helps format each piece of data in a readable, grid-like layout that enhances user understanding.
Syntax
<td align ="left | right | center | justify | char">Attribute Values
The <td> align attributes have the following attributes which are as:
Attributes
Description
left
It sets the text left-aligned of a container.
right
It sets the text right-align of the container.
center
It sets the text center-align.
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 1: In this example, we will see the implementation of the <td> align tag.
index.html
<html>
<head>
<title>
HTML td align Attribute
</title>
<style>
h1,
h2 {
text-align: center;
color: green;
}
</style>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>HTML td align Attribute</h2>
<table width="500" border="1">
<tr>
<th>NAME</th>
<th>AGE</th>
<th>BRANCH</th>
</tr>
<tr>
<td style="text-align: center;">BITTU</td>
<td style="text-align: left;">22</td>
<td style="text-align: right;">CSE</td>
</tr>
<tr>
<td style="text-align: left;">RAKESH</td>
<td style="text-align: center;">25</td>
<td style="text-align: left;">EC</td>
</tr>
</table>
</body>
</html>
Output:
OutputNote: The <td> align attribute is not supported by HTML5 instead uses CSS.
HTML is the foundation of webpages, is used for webpage development by structuring websites and web apps.You can learn HTML from the ground up by following this HTML Tutorial and HTML Examples.
HTML <td> align Attribute
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4