HTML and CSS Reference
In-Depth Information
margin-top: 1px;
margin-right: 20%;
margin-bottom: 0;
margin-left: 40px;
margin: 2em; /* shorthand: all sides */
margin: 2em 0; /* shorthand: top & bottom; right & left */
margin: 2em 0 1em; /* shorthand: top; right & left; bottom */
margin: 2em 0 1em 10px; /* shorthand: top; right; bottom;
left */
When margins from two elements contact each other on a page, they
“collapse” into one another with the resulting effect that the margin
between each element is the size of the largest of the two margin
properties. For example, if there is an <h2> with a bottom margin of
20 pixels followed by a paragraph with a top margin of 10 pixels, the
space between the two elements will be 20 pixels, not 30.
padding
The padding property sets the four padding dimensions between an
element's content area and its border. Each side may take one of the
following values:
<length> : The length will be a fixed dimension.
<percentage> : The length will be a percentage of the containing
block's width (applies for margins in the vertical as well as horizontal
directions).
padding-top: 1px;
padding-right: 20%;
padding-bottom: 0;
padding-left: 40px;
 
 
Search WWH ::




Custom Search