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
Jacek Slup-Libertowski
10,790 PointsProblems with positioning
Hi,
I have the same code and styling for the header on all the pages but ther is a Gap on my contacts page and i cannot figure out why.
Any help will be mucg appreciated.
3 Answers
Jonathan Grieve
Treehouse Moderator 91,254 PointsIt's probably something to do with problems with padding and margin interfering with the top of the page. That is overflowing so it causes a gap.
I can't get into specifics about why it is happening but I can tell you how to fix it.
If you change your margin property in the H3 style to
margin:0;
The gap will disappear. In fact it's a noramlize style that's doing it. So in your main.css file add this
h3 {
margin: 0;
display: block;
}
Mark Wilkowske
Courses Plus Student 18,131 PointsHey Jacek, first in the CSS, header {float:left;...} when I turn off that property in Firebug the top space goes away.
Second, in the HTML, <header> the <a> wraps around both <h> elements and this is invalid HTML because inline elements <a>'s cannot wrap around block elements <hx>'s. This invalid HTML seems to affect the <h3> below but I can't explain why.
Jacek Slup-Libertowski
10,790 PointsThanks for your replies, changing the margin on the h3 element helped.