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 trialElizabeth Ramos
7,163 Pointssetting the top padding to 68px on the body shifts everything down, including the fixed positioned main header.
Why is this happening? I don't think I missed a step. I thought fixed positioning would have kept the main header at the top but the padding shifted it down, so the first 68px of the page is blank.
1 Answer
Steven Parker
231,269 PointsBy itself, "fixed" just means it will stay where it is (won't scroll). You might have omitted properties to place it specifically at the top:
#fixed-element {
position: fixed;
top: 0; /* put it at the top */
left: 0; /* optionally, also put it at the left edge */
}
Luke Kennedy
11,661 PointsLuke Kennedy
11,661 PointsHi Steven,
Thank you for this. I recreate the whole project with my own twist for the CSS Layout basic again I was getting the same error as Elizabeth.
The top:0; (fixed the whole thing). Thank you again!
Luke.
nie hongda
4,632 Pointsnie hongda
4,632 PointsThank a lot bro, I have the same question before. I forgot the top property.