What is the difference between padding and margin?

Padding is the space inside an element between its content and border, while margin is the space outside an element’s border.