HTML
<td>
element
defines a cell of a table that contains data. It participates in the
表格模型
.
| 内容类别 | Sectioning root. |
|---|---|
| 准许内容 | 流内容 . |
| Tag omission |
The start tag is mandatory.
The end tag may be omitted, if it is immediately followed by a
<th>
or
<td>
element or if there are no more data in its parent element.
|
| Permitted parents |
A
<tr>
元素。
|
| Implicit ARIA role |
cell
if a descendant of a
<table>
element
|
| Permitted ARIA roles | 任何 |
| DOM 接口 |
HTMLTableDataCellElement
|
此元素包括 全局属性 .
colspan
1
. Values higher than 1000 will be considered as incorrect and will be set to the default value (1).
headers
<th>
elements that apply to this element.
rowspan
1
; if its value is set to
0
, it extends until the end of the table section (
<thead>
,
<tbody>
,
<tfoot>
, even if implicitly defined), that the cell belongs to. Values higher than 65534 are clipped down to 65534.
abbr
This attribute contains a short abbreviated description of the cell's content. Some user-agents, such as speech readers, may present this description before the content itself.
注意: Do not use this attribute as it is obsolete in the latest standard. Alternatively, you can put the abbreviated description inside the cell and place the long content in the title 属性。
align
This enumerated attribute specifies how the cell content's horizontal alignment will be handled. Possible values are:
left
: The content is aligned to the left of the cell.
center
: The content is centered in the cell.
right
: The content is aligned to the right of the cell.
justify
(with text only): The content is stretched out inside the cell so that it covers its entire width.
char
(with text only): The content is aligned to a character inside the
<th>
element with minimal offset. This character is defined by the
char
and
charoff
属性
Unimplemented (see
bug 2212
)
.
The default value when this attribute is not specified is
left
.
left
,
center
,
right
or
justify
values, apply the CSS
text-align
property to the element.
char
value, give the
text-align
property the same value you would use for the
char
.
Unimplemented
in CSS3.
axis
id
of a group of cells that this header applies to.
bgcolor
This attribute defines the background color of each cell in a column. It is a
6-digit hexadecimal RGB code
, prefixed by a '
#
'. One of the predefined
color kewords
can also be used.
To achieve a similar effect, use the CSS
background-color
特性。
char
align
is not set to
char
, this attribute is ignored.
charoff
height
height
特性代替。
scope
<th>
) element relates to. Only use this attribute with the
<th>
element to define the row or column for which it is a header.
valign
baseline
: Positions the text near the bottom of the cell and aligns it with the
baseline
of the characters instead of the bottom. If characters don't descend below the baseline, the baseline value achieves the same effect as
bottom
.
bottom
: Positions the text near the bottom of the cell.
middle
: Centers the text in the cell.
top
: Positions the text near the top of the cell.
To achieve a similar effect, use the CSS
vertical-align
特性。
width
width
特性代替。
见
<table>
for examples on
<td>
.
| 规范 | 状态 | 注释 |
|---|---|---|
|
HTML 实时标准
The definition of 'td element' in that specification. |
实时标准 | |
|
HTML5
The definition of 'td element' in that specification. |
推荐 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
td
|
Chrome 完整支持 1 | Edge 完整支持 12 | Firefox 完整支持 1 | IE 完整支持 Yes | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android 完整支持 Yes | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
abbr
弃用
|
Chrome 完整支持 1 | Edge 完整支持 12 | Firefox 完整支持 1 | IE 完整支持 Yes | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android 完整支持 Yes | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
align
弃用
|
Chrome ? | Edge 完整支持 12 |
Firefox
不支持
No
注意事项
|
IE 完整支持 Yes | Opera ? | Safari ? | WebView Android ? | Chrome Android ? |
Firefox Android
不支持
No
注意事项
|
Opera Android ? | Safari iOS ? | Samsung Internet Android ? |
axis
弃用
|
Chrome 完整支持 1 | Edge 完整支持 12 | Firefox 完整支持 1 | IE 完整支持 Yes | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android 完整支持 Yes | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
bgcolor
弃用
|
Chrome ? | Edge ? | Firefox 不支持 No | IE 完整支持 Yes | Opera ? | Safari ? | WebView Android ? | Chrome Android ? | Firefox Android 不支持 No | Opera Android ? | Safari iOS ? | Samsung Internet Android ? |
char
弃用
|
Chrome ? | Edge 完整支持 12 |
Firefox
不支持
No
注意事项
|
IE 完整支持 Yes | Opera ? | Safari ? | WebView Android ? | Chrome Android ? |
Firefox Android
不支持
No
注意事项
|
Opera Android ? | Safari iOS ? | Samsung Internet Android ? |
charoff
弃用
|
Chrome ? | Edge 完整支持 12 |
Firefox
不支持
No
注意事项
|
IE 完整支持 Yes | Opera ? | Safari ? | WebView Android ? | Chrome Android ? |
Firefox Android
不支持
No
注意事项
|
Opera Android ? | Safari iOS ? | Samsung Internet Android ? |
colspan
|
Chrome 完整支持 1 | Edge 完整支持 12 | Firefox 完整支持 1 | IE 完整支持 Yes | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android 完整支持 Yes | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
headers
|
Chrome 完整支持 1 | Edge 完整支持 12 | Firefox 完整支持 1 | IE 完整支持 Yes | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android 完整支持 Yes | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
rowspan
|
Chrome 完整支持 1 | Edge 完整支持 12 | Firefox 完整支持 1 | IE 完整支持 Yes | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android 完整支持 Yes | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
scope
弃用
|
Chrome 完整支持 1 | Edge 完整支持 12 | Firefox 完整支持 1 | IE 完整支持 Yes | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android 完整支持 Yes | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
valign
弃用
|
Chrome ? | Edge 完整支持 12 |
Firefox
不支持
No
注意事项
|
IE 完整支持 Yes | Opera ? | Safari ? | WebView Android ? | Chrome Android ? |
Firefox Android
不支持
No
注意事项
|
Opera Android ? | Safari iOS ? | Samsung Internet Android ? |
width
弃用
|
Chrome 完整支持 1 | Edge 完整支持 12 | Firefox 完整支持 1 | IE 完整支持 Yes | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android 完整支持 Yes | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
完整支持
不支持
兼容性未知
弃用。不要用于新网站。
见实现注意事项。