Bootstrap class: .navbar fixed-top

<nav class="navbar fixed-top navbar-dark bg-primary">
  <a class="navbar-brand" href="#">Fixed top</a>
</nav>

Preview

More in Bootstrap Navbar