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

White gap appears at top of page when I add float to image.

I’m about to complete the ‘How to make a website project course’ and have just added the media query to make the layout change past 480px. However, on my ‘about’ page a white gap (about 5mm tall) appears at the top of my website whenever I add float: left; to my profile photo. As soon as I delete the float, the gap above the header goes and the page is correct again. I do not know what on earth could be the problem! Here is my code from the ‘responsive’ file.

Thanks very much and l look forward to hearing what I've done wrong!

/******************************** PAGE: ABOUT ********************************/

.profile-photo { float: right; margin: 0 20px 0 20px; }

}

@media screen and (min-width:660px) {

/******************************** HEADER ********************************/ nav { background: none; float: right; font-size: 1.125em; margin-right: 0%; text-align: right; width: 45%; }

logo {

float: left; margin-left: 5%; text-align: left; width: 45%; }

h1 { font-size: 2.5em;
}

h2 { font-size: 1em; margin: 0 0 15px 0; }

header { border-bottom: 5px solid #999;

}

}

2 Answers

There is a missing period in front of logo. Is that a typo here or is that part of your code?

yes its a typo, I've fixed the problem now by removing padding and margin from the paragraph element in main.css.

Thanks very much

Good! Yeah margins and padding like to mess things up sometimes-especially the defaults on paragraphs and h1-h6.