HTML <th> align 属性

返回上一级

align 属性用于设置表头单元格中内容的水平对齐方式

HTML5 不支持 <th> align 属性,可以使用 CSS 代替

语法

<th align="left|right|center|justify|char"></th>

属性值

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

浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主流浏览器都支持 align 属性

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

范例

向左对齐表头单元格中的内容

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

运行范例 »

返回上一级

HTML 全部标签

关于   |   FAQ   |   我们的愿景   |   广告投放   |  博客

  简单教程,简单编程 - IT 入门首选站

Copyright © 2013-2022 简单教程 twle.cn All Rights Reserved.