margin-bottom
margin-left
margin-right
margin-top
PROPERTY: margin
margin
:
length
|
percentage
|
auto
Compatibility:
IE4+ N4+
Version:
Level 1
Inherited:
No
The
margin
property is a shortcut for setting the
margin-bottom, margin-left, margin-right,
and/or
margin-top
properties in one declaration.
You can declare one, two, three or four values:
If you declare one value, the size for all four margins will be that value.
If you declare two values, the top and bottom margins will be set by the first value, the right and left margins by the second.
If you declare three values, the top margin will be set by the first value, the right margin by the second, and the bottom and left margins by the third.
If you declare four values, the order is top, right, bottom, left.
length
The
length
value can be in any of the following seven units. Use the abbreviation.
Length
Abbrev.
centimeters
cm
ems
em
inches
in
millimeters
mm
picas
pc
pixels
px
points
pt
percentage
The
percentage
value is based upon the total width being defined as 100%.
auto
The
auto
value directs the browser to automatically calculate all four margins. By declaring
auto
, you can ensure that any previous declaration will not effect the margins.
Code:
body { margin: 25mm; }
body { margin: 1.0in; }
body { margin: 15pc 25pc; }
body { margin: 36pt 24pt 36pt; }
body { margin: 11.5%; }
body { margin: 10% 10% 10% 10%; }
body { margin: auto; }
Output:
Click to see example in separate window
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information