+ 1
What is the difference between Margin and Padding?
I find their properties to be similar.
4 Answers
+ 8
Imagine a box with borders, the area *outside* the border is the margin while the area *inside* is the padding.
If you have 2 boxes side-by-side, increasing the margin will separate the two further away but it's not the case for padding as it will push the content inside the box towards the centre until it collapse.
+ 5
margin is not clickable
padding is clickable
margin push your content.no width or height have been increased
padding push your content by increase width or height offset
https://code.sololearn.com/WdJWwRTqtRwD/?ref=app
+ 1
margin and padding are the two most commonly used properties for spacing-out elements. A margin is the space outside something, whereas padding is the space inside something. Change the CSS code for h2 to the following:
h2 { font-size: 1.5em; background-color: #ccc; margin: 20px; padding: 40px; }