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

CSS CSS Layout Basics Page Layout with the Float Property Wrapping Text Around Images with Floats

At 4:50, how and why does the picture 'scale' a little smaller?

How does the picture scale a little smaller?

1 Answer

Adam Pengh
Adam Pengh
29,881 Points

@baderbouta Since the image is inside of another element, when the instructor adds padding this forces the space available for the image to decrease by 10 on all sides. It has to do with the basic box model for CSS. Margin is outside the box, so margin creates space around the element, while padding is inside the box, so it forces the content within the element (the image) to shrink.

https://www.w3schools.com/css/css_boxmodel.asp

Gotcha! Thanks a lot!