padding: ***;

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O

The padding property sets the padding of an element.

The padding inside the cells can be specified by applying this property to the TD or TH element.


td, th {
padding: 10px;
}

Property Value Explanation
padding length, %, or auto the top, bottom, left, and right paddings
  • padding: 2px; : [all sides] paddings
  • padding: 2px 4px; : [top, bottom] [left, right] paddings
  • padding: 2px 4px 6px; : [top] [left, right] [bottom] paddings
  • padding: 2px 4px 6px 8px; : [top] [right] [bottom] [left] paddings

Example


<html>
<head>
<title>TAG index</title>

<style type="text/css">

table, th, td { border: 2px #2b2b2b solid; }
th, td { padding: 10px 20px; }

</style>

</head>
<body>

<table>
<tr>
<th>Heading A</th>
<th>Heading B</th>
</tr>
<tr>
<td>Cell A</td>
<td>Cell B</td>
</tr>
</table>

</body>
</html>

Output
Heading A Heading B
Cell A Cell B