Bootstrap class: .fixed-top

<div class="fixed-top bg-primary">Fixed top</div>

Preview

Fixed top

Sass source

/* _position.scss:15 */
.fixed-top {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: $zindex-fixed;
}

Uses variables

Code copied to the clipboard.

Copying failed

/* _position.scss:15 */
$zindex-fixed

More in Bootstrap Positioning