Check out example codes for "css padding vs margin". It will help you in understanding the concepts better.

Code Example 1

/* Answer to: "css padding vs margin" */

  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.

  For more information, head over to:

Learn ReactJs, React Native from