Zest.

CSS: Sticky header

A short, tested CSS example for sticky header. Copy it and adjust the names and paths for your project.

CSS
header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
}

Find it in Zest

Search for “css sticky header” in Zest and this example appears above the results, with other matches to choose from. Searches stay private.

More CSS examples

All CSS examples