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 trialStephen Benner
4,551 PointsI thought only Margin increases the space outside the element, padding increases the space inside the element?
Just wondering if they worded this question a little wonky or I'm misunderstanding.
1 Answer
Emre Karakuz
9,162 Pointscheck this : https://www.w3schools.com/css/css_boxmodel.asp
consider that you have an img on your site.
if you add margin to this img, you increase the space between the img and the other content.
if you add padding to this img, you increase the space between the img and its boundary.
try to change these values: https://www.w3schools.com/css/tryit.asp?filename=trycss_boxmodel_width
Stephen Benner
4,551 PointsStephen Benner
4,551 PointsExactly. The question asks "Margin and padding are used to increase and decrease the amount of space around an element." as in BOTH.
Wouldn't that be false? Only margin increases space around an element. Padding increases space inside the elements between the boundary and item as you've stated.