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

HTML Introduction to HTML and CSS (2016) Make It Beautiful With CSS Review: Make It Beautiful with CSS

Stephen Benner
Stephen Benner
4,551 Points

I 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
Emre Karakuz
9,162 Points

check 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
Stephen Benner
4,551 Points

Exactly. 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.