Home → References → CSS Properties →
CSS Property: margin, margin-top, margin-right, margin-bottom, margin-left
Specifies the margin around a box.
HTML Dog is hosted by Titan Internet
Possible Values
- [percentage]
- [length]
inheritautomargincan have:- one value such as
10pxto specify an equal margin on every side - two values, such as
10px 5px, to specify the top/bottom (first value) and right/left (second value) margin - three values, such as
10px 5px 2px, to specify the top (first value), right/left (second value) and bottom (third value) margin - four values, such as
10px 5px 2px 1pxto specify the top, right, bottom and left margins respectively
- one value such as
Example
#badger { margin-top: 3em; }
#wolverine { margin: 1em 100px; }
#pineapple { margin: 1em 3em 10px 0.5em; }

