HTML <tr> charoff Attribute

Last Updated : 22 May, 2026

The charoff attribute of the <tr> tag specifies the offset (number of characters) for aligning content based on a specific character. It was used with the char attribute and is now deprecated in HTML5.

  • Defines the offset (spacing) for alignment relative to a character.
  • Used with the char and align="char" attributes.
  • Value is a number (character offset).

Note: The charoff attribute is deprecated in HTML5; use CSS for alignment instead.

Syntax:

<tr charoff="number">

Attribute Values:

  • number: Specifies the numeric offset used for alignment.
  • Positive values: Align content to the right of the specified character.
  • Negative values: Align content to the left of the specified character.
html
<!--Driver Code Starts-->

<!DOCTYPE html>
<html>

<head>
    <title>tr charoff </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 tr charoff Attribute</h2>
<!--Driver Code Ends-->

        <table>
            <thead>
                <!-- tr tag starts here -->
                <tr align="char" charoff=".">
                    <th>Name</th>
                    <th>User Id</th>
                </tr>
                <!-- tr tag end here -->
            </thead>
            <tbody>
                <tr>
                    <td>Harry</td>
                    <td>@harry</td>
                </tr>
                <tr>
                    <td>GeeksforGeeks</td>
                    <td>@geeks</td>
                </tr>
            </tbody>
        </table>

<!--Driver Code Starts-->
    </center>
</body>

</html>

<!--Driver Code Ends-->
Comment