margin, margin-bottom, margin-left, margin-right, margin-top attribute

Type:length, percentage (calculated with respect to the width of the containing box)
Used By:All block elements
See:border padding

The margin attribute controls the space outside the border of an element, between that and it's neighbours. The space between the border and the content of an element is controlled by the padding attribute.

The margin for each side of the element can be set separately by using the margin-left, margin-right, margin-top or margin-bottom attributes, or the overall padding can be set by using the margin attribute.

If there is only one value, it applies to all sides. If there are two values, the top and bottom paddings are set to the first value and the right and left paddings are set to the second. If there are three values, the top is set to the first value, the left and right are set to the second, and the bottom is set to the third. If there are four values, they apply to the top, right, bottom, and left, respectively.

The margin around the content will always be transparent.

These examples set the top and bottom margin to 10pt and the left and right to 0pt.

P { margin-top: 10pt; margin-bottom:10pt; margin-left:0pt; margin-right:0pt; }
P { margin: 10pt 0pt; }