Cannot pass navbox at top of viewport criteria

My pen:

I’ve been doing the product landing page (a bit rushed, i know its not pretty) but I cant seem to get the 13th test “The navbar should always be at the top of the viewport.” to pass. Ive tried using a fixed position with top: 0px and what not but it keeps giving me the error that “expected 21.4375 to be close to 0 +/- 15”. I assume this is the distance from the top of the page but I dont know how to make it any smaller since the navbar is literally the top thing on the page.

Your navbar element is too big. That’s why you’re failing the test.

I’d recommend restructuring your HTML so your navbar isn’t in an <h1> tag.

But one of the other criteria is to have the nav element within a header element… and it gave me now a value of 47.7 for the distance even though the text is visually smaller and closer to the top :confused:

Okay. I tried putting the <h1> element back above the navbar, but changed it from <h1></h1> to <header></header> and it passed all 16 tests.

1 Like

Ahhh, is it just me or is that a kinda weird thing to have tripped it? Thanks so much for the help.

I struggled with this test on my project too. Glad you were able to get it to work!

1 Like