CSS Margins

Understanding Margins

Margins create space around elements, outside of any defined borders.

Margin Properties

  • margin: sets all four margins.
  • margin-top, margin-right, etc.

Examples

div { margin: 20px; }

p { margin-top: 10px; margin-bottom: 10px; }