HTML <td>标签用于指定表中的单元格或表数据。
<!DOCTYPE html> <html> <head> <title>HTML td Tag</title> </head> <body> <table border="1"> <tr> <th>Subject</th> <th>Topic</th> </tr> <tr> <td>Java</td> <td>Threading</td> </tr> <tr> <td>C++</td> <td>Virtual Functions</td> </tr> <tr> <td>Linux</td> <td>File Systems</td> </tr> </table> </body> </html>
这将产生以下结果-
此标签支持- HTML属性参考中所述的所有全局属性。
The HTML <td> tag also supports the following additional attributes -
Attribute | Value | 描述 |
---|---|---|
abbr | abbreviated_text | 不推荐使用-指定单元格中内容的缩写形式。 |
align | right left center justify char |
不推荐使用-外观对齐。 |
axis | name | 不推荐使用-指定此td的类别。 |
bgcolor | rgb(x,x,x) #hexcode colorname |
不推荐使用-指定表格单元格的背景色。 |
char | character | 不推荐使用-指定要在其上对齐文本的字符。在align =“ char”时使用 |
charoff | pixels or % | 不推荐使用-使用char属性指定相对于第一个字符的对齐偏移量。在align =“ char”时使用 |
colspan | number | 指定当前单元格跨越的列数。 |
header | id | 指定以空格分隔的标题单元列表,其中包含有关此单元格的信息。 |
height | pixels | 不推荐使用-指定表格单元格的高度。 |
nowrap | nowrap | 不推荐使用-防止文本自动换行。 |
rowspan | numbers | 指定当前单元格跨越的行数。 |
scope | col colgroup row rowgroup |
不推荐使用-此属性用于标头单元格,并指定将使用此标头信息的单元格。 |
valign | top middle bottom baseline |
不推荐使用-垂直对齐。 |
width | pixels or % | 不推荐使用-指定表格单元格的宽度 |
此标签支持- HTML事件参考中所述的所有事件属性。
Chrome | Firefox | IE | Opera | Safari | Android |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)