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

Brett Burley
Brett Burley
2,922 Points

Margin 2.5% on top and bottom as well?

I was wondering if the margin with a single value of 2.5% will give each list item a 2.5% margin around the whole thing or just on the left and right.

1 Answer

Kevin Korte
Kevin Korte
28,149 Points

It would give the margin all the way around, but in a grid system, you'd end up with 5% margin left and right, but still only 2.5% margin top and bottom because of collapsing vertical margins.

Brett Burley
Brett Burley
2,922 Points

In a grid system? Is the html layout always in a grid system? or does it become a grid system because we are stacking the pictures horizontally and vertically with float: left; and max-width: 45%.

Kevin Korte
Kevin Korte
28,149 Points

I use the term grid loosely. By grid, I mean you are using some sort of layout to position elements on the screen. That's your "grid".

So by having multiple elements on a page, with sizing and position, you have thus created your own grid. When you have elements positioned around each other, the vertical margins are going to collapse when two elements are stacked on top of each other.

Hopefully that helped clarify.

so it mean in that coding, the 2.5 % still give to the top and bottom?