The margin
property specifies the margin area on all four sides of an element. It is a shorthand for margin-top
, margin-right
, margin-bottom
, and margin-left
. When one value is specified, it applies the same margin to all four sides.
Using the shorthand property to set the margin for all four sides of a <p>
element to 40 pixels.
p { margin: 40px; }
Setting multiple margin values for the four sides of a <p>
element.
The top margin is 10px.
The right margin is 5px.
The bottom margin is 15px.
The left margin is 20px.
p { margin: 10px 5px 15px 20px; }
margin: value;
margin-top
, margin-right
, margin-bottom
, and margin-left
properties, respectively.For more information, see http://www.w3schools.com/cssref/pr_margin.asp
Found a bug in the documentation? Let us know at documentation@code.org