margin
Definition
The margin property is a shorthand method of setting margin-top, margin-right, margin-bottom and/or margin-left. The margin is the space between the element's border and the element's outer edge, represented by the yellow highlighted area in the illustration below.

Example
p {margin: 2em}p {margin: 2em 1em}
Characteristics
Possible values
- One, two, three or four of the following values: a specific length, a percentage of the parent element's width or the keyword
auto. If there is only one value, it applies to all sides. If there are two values, the first value is applied to the top and bottom sides, and the second value is applied to the right and left sides. If there are three values, the first value is applied to the top side, the second value is applied to right and left sides, and the third value is applied to the bottom side. If there are four values, the first value is applied to the top side, the second value is applied to the right side, the third value is applied to the bottom side and the forth value is applied to the left side. inherit- Use the same computed value as the parent element for this property.
Default value
See individual properties
Applies to
Most elements
Inherited
No
See also