Can I use CSS `position:sticky` outside the parent container?

Viewed 1508

My markdown looks something like -

<body>
  <header>
   <div class"logo" />
   <div class"contact-info" />
   <div class="sticky-navigation"/>
  </header>
<main>
  <!-- content -->
</main>
</body>

I need to make the div with class sticky-navigation behave like a sticky navigation when the user scrolls through body. Is there a way to use position:sticky to do the same?

As far as I've seen, the use of position:sticky is highly dependent on the markup and will only work on the whole of <header/>.

1 Answers
Related