303 HTML thead align 属性


HTML <thead> align 属性

实例

向左对齐 <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 属性。

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

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

定义和用法

HTML5 不支持 <thead> align 属性。请使用 CSS 代替。

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

语法

<thead align="left|right|center|justify|char">

属性值

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