Code Editor
Web Browser

Margins II

Just like padding, what if you don't want equal margin on all four sides of the box?

In that case, another version of the margin property lets you specify exactly how much margin there should be on each side of the box.

p { margin: 6px 12px 6px 12px; }

In the example above, the four values 6px 12px 6px 12px refer to the amount of margin around the box in a clockwise rotation. In order, it specifies the amount of margin on the top (6 pixels), right (12 pixels), bottom (6 pixels), and left (12 pixels) sides of the box.

When this version of the margin property is used, a margin value must be specified for all four sides of the box.

Report a Bug
If you see a bug or any other issue with this page, please report it here.