Next.js Discord

Discord Forum

How to make Layout level navbar sticky

Answered
Broken Nokia posted this in #help-forum
Open in Discord
I've defined the navbar at the root layout of my project, I've tried using the sticky tailwind class in both the outermost div and the header tag, but the navbar wont stick to the top when i scroll. How do i fix this?
Answered by Broken Nokia
i put top-0 and sticky to the outermost div and it's working now
View full answer

3 Replies

@Broken Nokia I've defined the navbar at the root layout of my project, I've tried using the sticky tailwind class in both the outermost div and the header tag, but the navbar wont stick to the top when i scroll. How do i fix this?
umm u can try like

<div>
<NavCompoent with className fixed and some zindex and top and positing and all />
<Rest of you Compent />


maybe this can help you
i put top-0 and sticky to the outermost div and it's working now
Answer
GG