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

HTML 参考手册

HTML 标签大全

HTML: <colgroup> charoff 属性

In HTML5 中,不支持 <colgroup> charoff 属性。charoff属性设置将内容与char属性指定的字符对齐的字符数。只有在指定了char属性并且align属性设置为“char”的情况下,才能使用charoff属性。

 HTML <colgroup> Tag

在线示例

在下面的示例中,表格中第二列的内容与字符 "." 向右两个字符的位置对齐:

!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML <colgroup> charoff 属性使用-基本教程(oldtoolbag.com)</title>
<style>table, th, td {  border: 1px solid black;}</style>
</head>
<body>
<table style="width:100%">
  <colgroup align="left"></colgroup>
  <colgroup align="char" char="." charoff="2></colgroup>
  <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:Almost all mainstream browsers do not support the charoff attribute.

Definition and Usage

In HTML5 In, the charoff attribute of <colgroup> is not supported.

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 when the char attribute is specified and the align attribute is set to 'char'.

Syntax

<colgroup charoff="number">

Attribute Value

ValueDescription
numberSpecify the alignment method.
Positive numbers are aligned to the right of the character.
Negative numbers are aligned to the left of the character.
 HTML <colgroup> Tag