TableHeader rowSpan attribute

Definition and usage

rowSpan Attribute sets or returns the value of the rowspan attribute.

<th> rowspan attribute Specify the number of rows a table cell should span.

Tip:Use colSpan attribute Set or return colspan attribute value.

See also:

HTML 参考手册:HTML <th> 标签

Example

Example 1

Change the number of rows a cell should span:

document.getElementById("myTh").rowSpan = "1";

Try it yourself

Example 2

Return the number of rows a specific table cell should span:

var x = document.getElementById("myTh").rowSpan;

Try it yourself

Syntax

Return rowSpan attribute:

tableheaderObject.rowSpan

Set rowSpan attribute:

tableheaderObject.rowSpan = number

属性值

描述
number 规定单元格应跨越的行数。

技术细节

返回值: 数值,表示表格单元格应跨越的行数。

浏览器支持

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
支持 支持 支持 支持 支持

相关页面

HTML 参考手册:HTML <th> rowspan 属性