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 How to Make a Website Adding Pages to a Website Add a New Page

Why my body margin still a problem when I already set it 0? I'm doing the WebDesign work!

Well, there is a huge chunck of empty space in my website, and I'm not sure what I'm missing here, the normalize.css already set body margin to 0!

http://s10.postimg.org/gu29tbz6h/coderror.jpg

Please help!

3 Answers

Robert Bojor
PLUS
Robert Bojor
Courses Plus Student 29,439 Points

Is the padding also set to 0?

Also a whitespace at the beginning of the file could cause the same problem.

James Ingmire
James Ingmire
11,901 Points

Yea cant remember the reason why this happens, when i remember i will post it. However to solve the problem you need to add border top of any value like 1px and it solves the issue.

element { 
    border-top: 1px solid #000;
}

Put your code up if still no luck.

James Barnett
James Barnett
39,199 Points

James Ingmire - You are referring to collapsing margins.

Matthew Craig
Matthew Craig
6,340 Points

Also, if I'm not mistaken, any block level elements(i.e. h1, h2, etc.) tend to push down their parent elements because of their default margin, which might explain what's going on there. Zero out the margin on the first heading and see what that does. Hope this helps!