HTML and CSS Reference
In-Depth Information
browser's window. In other words, the document body acts as if it has a 0 mar-
gin and a few pixels of padding when it comes to backgrounds, but its margin
controls the position of its child elements. A web author must explicitly set
the body's margin to 0 to eliminate the default space between the edges of the
browser's window and any content elements.
he margin and padding properties are actually shorthand notations for sets
of properties:
Any single value given to the margin or padding properties is applied to the
margins or padding on each side of the element. his shorthand notation
allows the author to specify diferent amounts on each side of an element in
the following manner:
p.intro { margin: 0 .5em 20px .5em; }
he ordering is clockwise: top , right , bottom , left . herefore, the preceding
rule is the same as this one:
p.intro {
margin-top: 0; /* zero amounts do not need units */
margin-right: .5em;
margin-bottom: 20px;
margin-left: .5em;
When given a value consisting of fewer than four amounts, the existing
amounts are recycled. hus, this
p.intro { padding: 0 2%; }
is the same as this:
p.intro { padding: 0 2% 0 2%; }
Search WWH ::

Custom Search