2. CSS Box Model

Padding, Border, Margin

As well as block-level as inline elements have background and colour properties. but block-level elements also have 3 important properties:

  • Padding: space between content and border
  • Margin: space between the element and next or previous element
  • Border: space between padding and margin

Example

Experiment with the CSS padding, border and margin properties of different elements.