HTML <thead> 标签的 align 属性

实例

下面的 HTML 表格将 thead 元素中的内容向左对齐:

<table border="1" width="100%">
  <thead align="left">
    <tr>
      <th>Month</th>
      <th>Savings</th>
    </tr>
  </thead>
    <tr>
      <td>January</td>
      <td>$100</td>
    </tr>
    <tr>
      <td>February</td>
      <td>$80</td>
    </tr>
</table>

亲自试一试

定义和用法

align 属性规定 thead 元素中的内容的水平对齐方式。

浏览器支持

所有浏览器都支持 align 属性。

注释:IE 无法正确地处理 "justify" 值,IE 会以居中的方式进行处理。

注释:几乎没有浏览器能够正确地处理 "char" 值。

语法

<thead align="value">

属性值

描述
left 左对齐内容(默认值)。
right 右对齐内容。
center 居中对齐内容(th 元素的默认值)。
justify 对行进行伸展,这样每行都可以有相等的长度(就像在报纸和杂志中)。
char 将内容对准指定字符。