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 get rid of the spaces located at the top of site.?

HOW TO get rid of the spaces located at the top of site.?

9 Answers

Try this:

body {
    margin: 0;
}

already done it.. nothin happen.. il l watch the videos again...

Try looking at the dev tools and see why there's space.

where can i find the dev tools?

Right click -> Inspect or F12 or Ctrl+Shift+I. That is for google chrome. I'm not sure if it's the same for other browsers.

OK Ok.. thank Jeremy Canela

try adding 1px of padding to the body. i remember doing that a few months ago..not sure if im right

Hi Mohammad, This question is a little difficult to answer without actually seeing the code or the issue you're dealing with. It could be that an element on your page is pushing things down, or maybe try setting margin: 0 on the html and the body.

Make sure you have not declared any margin values for the html element itself. Browsers typically have default margin values so setting it to 0 there should get rid of any unwanted white space.

Ex: html { margin: 0; }

Best, Max

If you are using inline block displays, you may try using a negative margin. Post your code?

Set the margin-top of h1 with the value 0 or try to use a margin-top property with negative value.