HTML <td> charoff Attribute

The HTML <td> charoff attribute is used to set the number of characters that are aligned with the characters specified by the char attribute. This attribute can only be used in the char attribute and align attribute is specified in the td element.

Note:  The <td> charoff attribute is not supported by HTML5.  

Syntax:

<td charoff="number">

Attribute Values:

  • number: It contains the numeric value which specifies the alignment of the td element.
    • Positive values: Indicate the alignment to the right of the characters.
    • Negative values: Indicate the alignment to the left of the characters.

Example: Below HTML code illustrates the use of charoff attribute in <td> element. 

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>w3wiki</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:

charoff Attribute” class=”aligncenter”>
HTML charoff Attribute

Supported Browsers:

  • Google Chrome Not supported
  • Internet Explorer Not supported
  • Firefox Not supported
  • Apple Safari Not supported
  • Opera Not supported

Contact Us