w3resource

HTML cellspacing attribute

cellspacing

The purpose of the HTML cellspacing attribute is to set a spacing between table cells.

Supported elements

HTML cellspacing attribute supports table element.

Syntax

<table cellspacing="value" >.....</table>

Type of value

Type of value of HTML cellspacing attribute is pixel, percent or multilength(i.e. relative length).

Value

A length in pixels, percent or a relative length.

Default value

There is no default value of HTML cellspacing attribute.

Supported doctypes

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

Example of HTML cellspacing attribute with table

<!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 cellspacing attribute with table</title>
</head>
<body>
<table border="1" cellspacing="10">
<tr>
<td>USA</td>
<td>Washington,D.C.</td>
</tr>
<tr>
<td>UK</td>
<td>London</td>
</tr>
</table>
</body>
</html>

Result

html cellspacing attribute with table

View this example in a separate browser window

Example of HTML cellspacing attribute with table.

Previous: HTML cellpadding attribute
Next: HTML char attribute

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.