Version: Level 1
Compability: IE4+ N4+
| Length | Abbrev. |
|---|---|
| centimeters | cm |
| ems | em |
| inches | in |
| millimeters | mm |
| picas | pc |
| pixels | px |
| points | pt |
The padding property is a shortcut that allows you to set the values for padding-bottom, padding-left, padding-right, and padding-top in only one declaration. This property is not inherited.
You can declare one, two, three, or four values:
If you declare one value, the amount of padding between all four borders and the contents will be that value.
If you declare two values, the top and bottom padding will be set by the first value, the right and left padding by the second value.
If you declare three values, the top padding will be set by the first value, the right padding by the second, and the bottom and left padding by the third.
If you declare four values, the order is top, right, bottom, left.
body { padding: 25mm; }
body { padding: 1.0in; }
body { padding: 16pc 25pc; }
body { padding: 36pt 24pt 36pt; }
body { padding: 11.5%; }
body { padding: 10% 10% 10% 10%; }<table border="2">
<tr>
<td style="padding: 22px 22px 22px 22px;">
22 pixels padding on all four sides
</td>
</tr>
</table>
22 pixels padding on all four sides