We've seen on the previous page how to draw a CSS border around an element. It's possible to control the space between the border and content by changing the so-called padding.
In fact, borders and paddings and part of the CSS box model. The picture on the right illustrates this concept. Every HTML element works this way.
Padding individual sides
You can change the padding of each element side separately by applying a length value to padding-top, padding-right, padding-bottom or padding-left.
<h2>h2 uses 1em padding for all 4 sides</h2> <h3>h3 has 1em padding for the top and bottom and 0 padding for the left and right side</h3> <h4>h4 has 1em padding for the top, 0 for the left and right side and 2em for the bottom</h4> <h5>h5 uses a different padding for each side going from top to right, bottom and left</h5>