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 eliminate white space?

Hi, everyone. I am new here. I already had knowledge of HTML/CSS before I came here; However, I have learned a lot here. HTML I know it inside out and I am trying to do the same with CSS. I am following the deep dive on CSS, and I am trying to eliminate the white space that the browser generates for default between the head div of my page and the top of the browser. How can I achieve it?

2 Answers

Not knowing what you code looks like, most likely you only need to remove the top margin from your div, or remove all the margins from the body.

That was the first thing I did. But I already solve the problem by applying the following code to my CSS.

*{ margin:0; padding:0;

}

Kevin Korte
Kevin Korte
28,148 Points

I would recommend for every project, the first thing you do is add normalize.css. You can download it here: http://necolas.github.io/normalize.css/

Ben Dickie
Ben Dickie
1,559 Points

Hi Kevin

Also if you developing a website (not so much the deep dive) a lot of people use a css reset loaded before the general styling, something like http://css-tricks.com/snippets/css/meyer-reset/ and this should address that margin/padding problem also.