5 of 8
deleted 4 characters in body
MAChitgarha
  • 3.8k
  • 2
  • 34
  • 40

It's good to know the differences between margin and padding. Here are some differences:

  • Margin is outer space of an element, while Padding is inner space of an element.
  • Margin is the space outside the border of an element, while Padding is the space inside the border of it.
  • Margin accepts the value of auto: margin: auto, but you can't set Padding to auto.
  • Margin can be set to any number, but Padding must be non-negative.
  • When you style an element, Padding will be affected also (e.g. background color), but not Margin.
MAChitgarha
  • 3.8k
  • 2
  • 34
  • 40