Best to provide code for future reference but use a CSS selector to select the element you want to stick at the top of the page. Using position: fixed
with property top:0
essentially takes it out of the flow of the DOM.
Lets say:
html
<div class="navbar">
<ul>
<li>Item</li>
<li>Item</li>
<li>Item</li>
</ul>
</div>
css
.navbar {
position: fixed;
top: 0;
width: 100%;
overflow: hidden;
}
Bootstrap is used and tested CSS framework that helps reduce development time, and has documentation for numerous scenarios, one being fixed nav. Check it out https://v4-alpha.getbootstrap.com/examples/navbar-top-fixed/
solved How can i make static header for a web page? [closed]