English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag大全

HTML: <col> charoff Attribute

The charoff attribute sets the number of characters to align the content with the character specified by the char attribute. The charoff attribute can only be used if the char attribute is specified and the align attribute is set to "char".

 HTML <col> tag

Online Example

In the following HTML table, the content of the second column is aligned two characters to the right of the character ".":

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML <col> charoff Attribute Usage-Basic Tutorial(oldtoolbag.com)</title>
<style>table, th, td { border: 1px solid black;</style>
</head>
<body>
<table style="width:100%">
  <col align="left">
  <col align="char" char="." charoff="2">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100.00</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$10.00</td>
  </tr>
</table>
</body>
</html>
Test See ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Note: All mainstream browsers do not support the charoff attribute.

Definition and Usage

HTML5 The <col> charoff attribute is no longer supported.

The charoff attribute specifies the alignment offset of the content relative to the character specified by the char attribute.

The charoff attribute can only be used when the align attribute is set to "char" and the char attribute has been set.

Syntax

<col charoff="number">

Attribute Value

ValueDescription
numberSpecifies the alignment method.
Positive numbers are aligned to the right of the character.
Negative numbers are aligned to the left of the character.
 HTML <col> tag