CSS Margin and Padding Properties

Margin and Padding CSS Reference. Includes a link to each Property, and its useful Example.

These are the Margin and Padding Properties of CSS. Used to control the space between elements, and the space to elements content (padding). The below box-model illustration may help you understand how margin and padding works.

CSS Box-model, illustration showing how elements are effected by margin and padding.

Margin Properties

  1. margin
  2. margin-top
  3. margin-right
  4. margin-bottom
  5. margin-left

Margin is used to create "space" outside the box its applied to, it can roughly be translated into, spaceing between elements.

Padding Properties

  1. padding
  2. padding-top
  3. padding-right
  4. padding-bottom
  5. padding-left

The padding properties, are used to create "space" between the edge of a parent element, and its children.