CSS Property: margin
[this page | pdf | back links]
The CSS (CSS1) margin property is a shorthand
property combining all four margin properties. The individual margin widths can
be set separately using margin-bottom,
margin-left, margin-right
and margin-top.
As with some other aggregate edge properties, up to four parameter values can
be supplied (and if more than one is supplied then the properties are applied
to individual borders as described here).
Valid property values
(other than inherit
and initial) are
defined by the elements of the shorthand. Shorthand elements included in the margin
property are:
|
Value
|
Description
|
|
length
|
Any specified margin
size as a CSS length
|
|
%
|
Margin specified as
percentage of width of container
|
|
auto
|
Browser calculates margin
|
|
Default Value:
|
0
|
|
JavaScript syntax:
|
e.g. object.style.margin="25px 30px"
|
|
Inherited:
|
No
|
|
Animatable:
|
See individual
properties
|
NAVIGATION LINKS
Contents | Prev | Next | CSS Properties