What exactly is the difference between margin and padding in CSS? It really doesn't seem to serve much purpose. Could you give me an example of where the differences lie (and why it is important to know the difference)?
Css – Difference between margin and padding
css
Related Topic
- Html – How to style a
- Html – How to remove the space between inline/inline-block elements
- Css – What’s the difference between SCSS and Sass
- Css – the difference between Normalize.css and Reset CSS
- Css – the difference between display: inline and display: inline-block
- Javascript – Is it possible to apply CSS to half of a character
Best Answer
padding
is the space between the content and theborder
, whereasmargin
is the space outside the border. Here's an image I found from a quick Google search, that illustrates this idea.