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

melissa brown
4,670 Pointspadding vs margins
Hi guys Im trying to understanding paddings and margins better. Is it right to say margins are used to create space between two separate elements eg pic and paragraph and padding is used to create space between an individual element eg content and its border?
2 Answers

James Alker
8,554 PointsYou're pretty much bang on the money there.
Margin = space outside element border - pushes itself or other content away
Padding = space between border of element and content / child elements

Lexis Hamilton
10,181 PointsGreat question. I find an image from the W3C to be pretty helpful in clarifying. Check it out here: (http://www.w3.org/TR/CSS2/box.html)
Also, if you ever need to check, I suggest throwing in a border to see where you're adding space. Try it out!