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

Trying to make a mobile practice site and I can't get rid of my white-space.

I keep having trouble with my margins on my site for some reason. I'm having a real hard time every time I make a new site with figuring out the margins, and which ones to apply 0 margins to. I've have eliminated the margin gaps in the rest of my site, but this one is giving me a headache. The site isn't fully styled yet. The white space is at the very top of the page, at the "Welcome to my hobby" page and the top of the browser view port. You can see a big gap. I would like this gap to be eliminated. I can get the margin to disappear if I use a negative margin of 25px but, I don't think a negative value is a good way to target the margin, any suggestions would be great. My code pen link is below. And thanks for any help.

http://codepen.io/mike316/pen/dhLfx

2 Answers

Hi Mr. X, try with this css rule:

h1 {
margin-top: 0;
}

I hope that solves the problem.

thanks that did the trick. I had to set the body to margin 0 also. Because, the h1 moved it up a little. I thought I tried the h1 and it didn't work. So, I gave up. Thanks again for your help. I feel so stupid because, the whitespace for me is the hardest part for me to get removed. I have asked numerous times about whitespace, and I keep screwing it up.

Yeah, it's hard to understand at the first time, but with practice it becomes second nature. Something that has been useful to me are the Developer Tools, always use it because you can see the Styles applied and modify on the fly, it's a great learning tool. Check Nick's video about DevTools and Guil's videos about The Box Model in the CSS Foundations.

Good luck and keep asking, at some point will become easier.