HTML cellpadding attribute
cellpadding
The purpose of the HTML cellpadding attribute is to set a spacing within table cells.
Supported elements
HTML cellpadding attribute supports table element.
Syntax
<table cellpadding="value" >.....</table>
Type of value
Type of value of HTML cellpadding 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 cellpadding attribute.
Supported doctypes
HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset.
Example of HTML cellpadding 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 cellpadding attribute with table</title>
</head>
<body>
<table border="1" cellpadding="10">
<tr>
<td>USA</td>
<td>Washington,D.C.</td>
</tr>
<tr>
<td>UK</td>
<td>London</td>
</tr>
</table>
</body>
</html>
Result

View this example in a separate browser window
Example of HTML cellpadding attribute with table
Previous: HTML border attribute
Next: HTML cellspacing attribute
Test your Programming skills with w3resource's quiz.
- Weekly Trends
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
- JavaScript functions Exercises
- Python Tutorial
- Python Array Exercises
- SQL Cross Join
- C# Sharp Array Exercises
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook