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

Why did the teacher set "padding" and "margin" of "#gallery" to "0" at first? If not, what would happen?

Why did the teacher set "padding" and "margin" of "#gallery" to "0" at first? If not, what would happen?

1 Answer

Tim Knight
Tim Knight
28,888 Points

Nick sets the #gallery to a margin and padding of zero because he's using an unordered list to create that gallery id. An unordered list has it's own margin and padding by default because it's normally used for bullet lists. But removing the default spacing he's about to start with a blank slate and space things out the way he'd prefer. You can actually see what happens without it before he adds those declarations a few minutes back on the video when he is just scrolling through the page and the images are slightly off-center and pushed to the right.