Open In App

HTML <th> charoff Attribute

Last Updated : 08 Feb, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The HTML th charoff Attribute is used to sets the number of characters that aligned the characters specified by the char Attribute. This attribute can only be used in the char attribute and align attribute is specified in the th Element.

Note:  The th charoff attribute is not supported by HTML 5. 

Syntax:

<th charoff="number">

Attribute Values:

  • number: It contains the numeric value which specify the alignment of the element.
  1. Positive values: indicate the alignment to the right of the characters.
  2. Negative values: indicate the alignment to the left of the characters.

  
 

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

 

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>HTML th charoff attribute  </title>
    <style>
        body {
            text-align: center;
        }
         
        h1,h2 {
            color: green;
        }
         
        th {
            color: blue;
        }
         
        table,
        tbody,
        td {
            border: 1px solid black;
            border-collapse: collapse;
        }
    </style>
</head>
 
<body>
    <center>
        <h1>GeeksforGeeks</h1>
        <h2> HTML th charoff Attribute</h2>
        <table>
            <thead>
                <!-- tr tag starts here -->
                <tr align="char" charoff=".">
                    <th align="char" charoff="." >
                        Country_name
                    </th>
                    <th>Total Medals</th>
                </tr>
            <thead>
            <tbody>
                <tr>
                    <td>China</td>
                    <td>34</td>
                </tr>
                <tr>
                    <td>India</td>
                    <td>45</td>
                </tr>
            </tbody>
        </table>
    </center>
</body>
 
</html>


Output:

HTML th charoff Attribute

Supported Browsers: This attribute is depreciated from HTML5 and not in use.
 



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads