本文档基于 CC协议(Creative Commons Share-Alike License)发布,是developer.mozilla.com, www.mozref.comwww.aptana.com共同劳动的成果。

margin

Defines the widths (in pixels, points, or a percentage) for the margins for the element.

Browser/User Agent Support

IENetscapeMozillaOperaSafari
4.0+4.0+1.0+4.0+1.0+

Usage

[top] [right] [bottom] [left]

Example

To specify a margin that is 10px wide on the top and left and 5px wide on the bottom and right, use the following syntax: body {margin: 10px 5px 5px 10px;}.

Remarks

Use the margin property as a shortcut to typing out all of the individual margin properties separately. You can specify any valid value for a margin property as part of margin.

You can specify up to four different widths for the margin of an element.

Availability

W3C CSS2

Related