3. The navbar should always be at the top of the viewport, I need help on this

Why cant i get the code to work even though it is already on the top like this with my css code:

ul {
    list-style-type: none;
    background-color: #000;
    font-family: Roboto, sans-serif;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;

i think you should add z-index with positive number. Try it, let me know if didn’t solve your problem.

I added z-index: 999; but it still doesn’t work, the error also says this:

Even though the navbar’s parent element is body

try adding these codes to <nav> not in <ul>

Oh it worked, thank you

1 Like