Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Jeff Goes
2,745 Pointswhat is the difference between calling 'padding' and 'margin', what is the exactly diference between them? thank you
I just would like to know the difference so I can use it appropriately. Thank you all
5 Answers

Jesus Mendoza
23,287 PointsIn html all containers have borders.
- Margin adds space to the outside of the containers border.
- Padding adds space to the inside of the containers border.
Check this example: http://codepen.io/Jesusz0r/pen/VYGKLP

Julian Pinzón Eslava
11,401 PointsSometimes a graphic explanation is best to really understand the difference between margin and padding --> http://guistuff.com/css/images/boxmodel.png

Roberto Cardenas
10,478 PointsPadding adds space around your content and the border. Used to add space to text, images, etc.
Margin adds space outside your content and the border. Used to separate one element from another.

Jelique Edward
1,691 PointsThe difference between padding and margin is that specifying a value for the margin of an element will move said element around the page. For example, if you set the "margin-left" to 20px, this will move the element 20px across the screen from the left.
Where as padding will extend the space between the content of the element and it's border. If you set the "padding-bottom" to 20px, the bottom border of this element will extend down.

Jeff Goes
2,745 PointsThank you all!! Got it now :)
Roberto Cardenas
10,478 PointsRoberto Cardenas
10,478 PointsI agree.