Last Updated : 23 Jul, 2025
The HTML <td> charoff attribute specifies the offset for aligning text around a specified character within a table cell. It is used with the char attribute and is now considered obsolete in modern HTML. This attribute can only be used in the char attribute and the align attribute is specified in the td element.
SyntaxNote: The <td> charoff attribute is not supported by HTML5.
<td charoff="number">Attribute Values
Example: In this example we creates a table using the <td> charoff attribute to align content based on character offset. However, the charoff attribute is now obsolete.
HTML
<!DOCTYPE html>
<html>
<head>
<title>HTML td charoff attribute </title>
<style>
body {
text-align: center;
}
h1 {
color: green;
}
th {
color: blue;
}
table,
tbody,
td {
border: 1px solid black;
border-collapse: collapse;
}
</style>
</head>
<body>
<center>
<h1>GeeksforGeeks</h1>
<h2> HTML td charoff Attribute</h2>
<table>
<thead>
<!-- tr tag starts here -->
<tr align="char" charoff=".">
<th>Country_name</th>
<th>Ranking</th>
</tr>
<thead>
<tbody>
<tr>
<td align="char" charoff=".">
China</td>
<td>34</td>
</tr>
<tr>
<td>India</td>
<td>45</td>
</tr>
</tbody>
</table>
</center>
</body>
</html>
Output:
HTML charoff Attribute Supported BrowsersRetroSearch 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