Code Editor
Web Browser

Margin III

Take a look at the following code. What do you notice about the margin values?

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

The top and bottom values of margin are the same (6px) and the left and right value of margin are also the same (12px).

Just like the padding shortcut, when you're certain that the top and bottom values for margin will equal each other, and that the left and right values for padding will also equal each other, you can use the following shortcut:

p { margin: 6px 12px; }

The first value, 6px, sets a margin value for the top and bottom sides of the box. The second value, 12px sets a margin value for the left and right sides of the box.

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