当前位置: 首页 > 网络学院 > 网页制作基础教程 > HTML > HTML <th>标签

HTML
HTML 介绍
HTML 元素
HTML 基本标签
HTML 格式
HTML 实体字符
HTML 链接
HTML 框架
HTML 表格
HTML 列表
HTML 表单
HTML 图片
HTML 背景
HTML 颜色
HTML 颜色值
HTML 颜色名
HTML 便条
HTML 布局
HTML 字体
HTML 4.0
HTML 样式

HTML <th>标签


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 439 ::
收藏到网摘: n/a

定义与用法

Defines a table header cell in a table. The text within the th element usually renders in bold.
定义表格的标题单元。一般在th元素里的文字都为粗体


在HTML和XHTML中的区别

The "bgcolor", "height", "width", and "nowrap" attributes of the th element were deprecated in HTML 4.01.
在HTML4.01中th元素的"bgcolor", "height", "width",以及 "nowrap"属性不再被推荐使用

The "bgcolor", "height", "width", and "nowrap" attributes of the th element are not supported in XHTML 1.0 Strict DTD.
XHTML1.0严密型DTD已经不再支持th元素的"bgcolor", "height", "width",以及 "nowrap"属性


实例

代码 输出结果
<table border = "1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Cell A</td>
<td>Cell B</td>
</tr>
</table>
Header 1 Header 2
Cell A Cell B


可选属性

DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
下表中的DTD列指明了被支持的DTD属性。S=Strict(精确的),T=Transitional(传统的),F=Frameset(框架)

属性 描述 DTD
abbr abbr_text Specifies an abbreviated version of the content in a cell
指定单元的省略内容
STF
align left
right
center
justify
char
Specifies the horizontal alignment of cell content
指定单元内容的水平对齐方式
STF
axis category_names Defines a name for a cell
为单元格命名
STF
bgcolor rgb(x,x,x)
#xxxxxx
colorname
Specifies the background color of the table cell. Deprecated. Use styles instead.
指定单元格的背景颜色[不推荐]请使用样式
TF
char character Specifies which character to align text on.
指定以哪个字符做对齐

Note: Only used if align="char"!
注意:只有当align="char"的时候才能使用

STF
charoff pixels
%  
Specifies the alignment offset to the first character to align on.
取消向第一个字符的对齐方式

Note: Only used if align="char"!
注意:只有当align="char"的时候才能使用

STF
colspan number Indicates the number of columns this cell should span
指明该单元格应有多少列的跨度
STF
headers header_cells'_id A space-separated list of cell IDs that supply header information for the cell. This attribute allows text-only browsers to render the header information for a given cell
针对单元格指定一列可以支持标题信息的单元格ID。这个属性允许文字浏览器显示出给定单元格的标题信息。
STF
height pixels Specifies the height of the table cell. Deprecated. Use styles instead.
指定表格单元的高度[不推荐]请使用样式
TF
nowrap nowrap Whether to disable or enable automatic text wrapping in this cell. Deprecated. Use styles instead.
指定单元格是否能够自动换行文字。[不推荐]请使用样式
TF
rowspan number Indicates the number of rows this cell should span
指明该单元格应有多少行的跨度
STF
scope col
colgroup
row
rowgroup
Specifies if this cell provides header information for the rest of the row that contains it (row), or for the rest of the column (col), or for the rest of the row group that contains it (rowgroup), or for the rest of the column group that contains it
指明这个单元格是否支持为余下的行(组)/列(组)提供标题信息
STF
valign top
middle
bottom
baseline
Specifies the vertical alignment of cell content
指明单元格内容的垂直对齐方式
STF
width pixels
%
Specifies the width of the table cell. Deprecated. Use styles instead.
指定表格单元的宽度[不推荐]请使用样式
TF

标准属性

id, class, title, style, dir, lang, xml:lang

For a full description, go to Standard Attributes.
查看完整的属性

事件属性

onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

For a full description, go to Event Attributes.
查看完整的属性


尝试与演示

Tables
How to create tables in an HTML document.
在HTML中建立表格

Table borders
Different table borders.
定义表格的边框

Table with no borders
A table with no borders.
一个没有边框的表格

Headings in a table
How to display table headers.
显示表格的标题

Empty cells
How to use "&nbsp;" to handle cells that have no content.
如何使用"&nbsp"来处理没有内容的单元格

Table with a caption
A table with a caption.
带有标题的表格

Table cells that span more than one row/column
How to define table cells that span more than one row or one column.
如何定义一个带有多行或多列跨度的表格

Tags inside a table
How to display elements inside other elements.
如何在另外的元素的里面显示元素

Cell padding
How to use cellpadding to create more white space between the cell content and its borders.
如何使用使用cellpadding来增加单元格到文字间的距离

Cell spacing
How to use cellspacing to increase the distance between the cells.
如何使用cellpacing来增加单元格之间的距离

Add a background color or a background image to a table
How to add a background to a table.
如何给表格加上背景

Add a background color or a background image to a table cell
How to add a background to one or more table cells.
如何为表格单元格加上一个或多个背景

Align the content in a table cell
How to use the "align" attribute to align the content of cells.
如何使用"align"属性来对齐单元格里的文字

The frame attribute
How to use the "frame" attribute to control the borders around the table.
怎样使用"frame"属性来控制表格周围的边框

评论 (0) All

登陆 | 还没注册?