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 How to Make a Website Styling Web Pages and Navigation Style the Portfolio

Jacob Brech
Jacob Brech
7,224 Points

Why does the 2.5% margin only apply to the left and right side of the image?

This is confusing to me. When you set the margin: 2.5%; it should apply to all sides. Why is this not even mentioned or explained in the video? Does someone have a good answer for this? Thanks!

1 Answer

Benjamin Larson
Benjamin Larson
34,055 Points

You're correct! That margin is being applied to all sides. He only states that it's filling in the extra width of the page, which is true, but if you play with the code in Workspaces you'll also notice that the margin: 2.5% is affecting the vertical margin between the gallery list items. Play around with it in Workspaces and set really high values for different properties to test whenever you aren't sure. Also be aware of the shorthand notations for different CSS properties like margin. Learn more about margin here - http://www.w3schools.com/css/css_margin.asp

Jacob Brech
Jacob Brech
7,224 Points

Thanks Benjamin! That helps a lot!