Sticky header
HTML
<div>
<header class="sticky-header__header">...</header>
<main>...</main>
</div>
CSS
.sticky-header__header {
/* Stick to the top */
position: sticky;
top: 0;
}
Demo
Have you seen CSS Scan?
The fastest and easiest way to check, copy and edit CSS.
Learn more →
<div>
<header class="sticky-header__header">...</header>
<main>...</main>
</div>
.sticky-header__header {
/* Stick to the top */
position: sticky;
top: 0;
}