Is it possible to keep relative elements below a sticky navbar

Viewed 159

The issue I am facing right now is that, when I have a navbar with position:sticky and I have a div with position:relative and in that another element with position:absolute then, when scrolling down, the relative div puts itself above the navbar.

I saw another thread that told the op to just use position:fixed but I really want to use sticky because the navbar is below the header and even though I could solve that by using javascript and fixed I'd rather not cause that made the navbar glitch etc. when scrolling to certain points.

Is it possible to have relative elements below sticky ones or is that just simply impossible?

While not scrolling: While you arent scrolling

While scrolling: While scrolling

What I'm trying to accomplish: What it's supposed to look like

1 Answers

Try adding z-index: 1 to the navbar and to the slideshow add margin: 40px;

Related