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! While you're at it, check out some resources Treehouse students have shared here.
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
Andrew Ge
2,158 PointsDifference Between Margin and Padding
What is the difference between adding margin and padding? Also, definitions and/or examples will be of extra thanks.
2 Answers
Andrew Theis
3,153 PointsMargin is the space around the outside of the particular element. The padding is the space on the inside of an element, between the element and the content of that element.
If you draw a box with a capital A on the inside, the margin is the space between the box and the edge of the page. The padding is the space between the box and the A on the inside.
Hope that helps!
Ken Alger
Treehouse TeacherAndrew;
Take a look at the Introduction to the CSS Box Model page on the MDN. Post back if you have further questions.
Happy coding,
Ken
Andrew Ge
2,158 PointsAndrew Ge
2,158 PointsThanks guys!