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

mohammed mayat
mohammed mayat
4,228 Points

ccs space betwwen nav and hero section

hi guys they is a space between navbar and hero section how do i get rid of it

https://codepen.io/mmayat10/pen/pWPPWN

2 Answers

Carl Evans
Carl Evans
11,679 Points
#header { 
 margin-top: -25px;
}

It's because you have so much padding on your hero title that is in an h1 tag. H1 tags have margin by default so the default margin is actually pushing the whole container down. I would suggest centering your title a different way vertically. You can make a hero container with a display of flex. Make sure the flex direction is column. Then put an align self on the heading to center.