Z-Index doesn't seem to be working (CSS)

Here is the start of a small project I’m working on:

I added this to the navigation bar:

#nav-bar {
  position: fixed;
  z-index: 1;
  width: 100%;
  top: 0;
  left: 0;
  padding-top: 10px;
  padding-bottom: 10px;
}

However other elements are still appearing above the navigation bar, rather than hiding underneath when scrolling.

Does anyone know how to solve this? I’ve tried and no luck. Thanks.

Hi there bmcode,

and a warm welcome to these forums. :winky:

Try adding this…

    background-color: #eee
}

…to your #nav-bar rules.

coothead

Hey, it worked! Thanks a lot.

Did it not work because the background was transparent?

That is correct. :biggrin:

coothead

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.