当前位置: 首页 > 网络学院 > 网页制作基础教程 > HTML > HTML <td>标签
Defines a cell in a table.
定义表格内的一个单元
The "bgcolor", "height", "width", and "nowrap" attributes of the td element were deprecated in HTML 4.01.
在HTML4.01中td元素的"bgcolor", "height", "width",以及 "nowrap"属性不再被推荐使用
The "bgcolor", "height", "width", and "nowrap" attributes of the td element are not supported in XHTML 1.0 Strict DTD.
XHTML1.0严密型DTD已经不再支持td元素的"bgcolor", "height", "width",以及 "nowrap"属性
代码 | 输出 | ||
---|---|---|---|
<table border = "1"> <tr> <td>Cell A</td> <td>Cell B</td> </tr> </table> |
|
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"! | STF |
charoff | pixels % | Specifies the alignment offset to the first character to align on. 取消向第一个字符的对齐方式 Note: Only used if 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 " " to handle cells that have no content.
如何使用" "来处理没有内容的单元格
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"属性来控制表格周围的边框