w3resource

HTML rowspan attribute

rowspan

The purpose of the HTML rowspan attribute is to define the number of rows spanned by an individual table cell.

Supported elements

HTML rowspan attribute supports td and th elements.

Syntax

<ElementName rowspan="value" >.....</ElementName>

Where ElementName is any supported element.

Type of value

Number.

Value

A number.

Default value

Default value of HTML rowspan attribute is 1.

Supported doctypes

HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset.

Example of HTML rowspan attribute with td element

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example of HTML rowspan attribute with  td element</title>
</head>
<body>
<table width="200" border="1" cellpadding="2">
<tr>
<td> </td>
<td rowspan="2">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

Result

HTML rowspan attirbute with  td element

View this example in a separate browser window

Example of HTML rowspan attribute with td element

Example of HTML rowspan attribute with th element

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example of HTML rowspan attribute with  th element</title>
</head>
<body>
<table width="200" border="1" cellpadding="2">
<tr>
<th>  </th>
<th rowspan="2">&nbsp;</th>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

Result

html rowspan attribute with th element

View this example in a separate browser window

Example of HTML rowspan attribute with th element

Previous: HTML rows attribute
Next: HTML rules attribute

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/html/attributes/html-rowspan-attribute.php