TUTORIALReferencesFETCHED

HTML <th> charoff 属性

HTML &lt;th&gt; charoff 属性 HTML &lt;th&gt; 标签 实例 把第一个表头单元的的内容与 'M' 字符向右二个字符的位置对齐: &lt;table border='1'&gt; &lt;tr&gt; &lt;th align='char..

Updated 7/16/2026

Tutorial detail pages default to noindex.

HTML <th> charoff 属性

HTML th 标签参考手册 HTML <th> 标签

实例

把第一个表头单元的的内容与 "M" 字符向右二个字符的位置对齐:

<table border="1">
  <tr>
    <th align="char" char="M" charoff="2">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>

尝试一下 »

浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

几乎所有的主流浏览器都不支持 charoff 属性。


定义和用法

HTML5 不支持 <th> charoff 属性。

charoff 属性设置内容相对于由 char 属性规定的字符的对齐偏移量。

仅当 align 属性设置为 "char" 且已设置 char 属性时,才能使用 charoff 属性。


语法

<th charoff="number">

属性值

值 描述
number 规定对齐方式。
正数规定向字符的右边对齐。
负数规定向字符的左边对齐。


HTML th 标签参考手册 HTML <th> 标签