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 The CSS Box Model Margin

Still seeing a margin with margin: 0;

body {
  margin: 0;
}

Still displays a substantial margin for me on Chrome. (The top of the header is NOT flush with the browser, there is a lot of white space. It still looks like the browser default settings.) Why?

2 Answers

Rich Donnellan
MOD
Rich Donnellan
Treehouse Moderator 27,740 Points

I spun up a new workspace for this lesson and was able to update the code to remove the body margins.

Make sure to save the file and refresh the page. It's not a "hot" reloaded workspace.

Link to your workspace if you still have issues.

Shaun Kelly
Shaun Kelly
9,646 Points

Hi, have you removed the default styling from your project? If you search the web for reset css this may give you a more detailed breakdown of what is happening.

Before I start any styling on a project I tend to add this code to the top of my stylesheet: *{ margin: 0;padding: 0;box-sizing: border-box;}