Problem Statement
How would you create a sticky header that remains at the top while scrolling?
Explanation
Apply `position: sticky` with `top: 0`. This allows the header to scroll with the page until it reaches the top, then it sticks. Ensure parent containers do not have overflow hidden, or it won’t work.
Code Solution
SolutionRead Only
header { position: sticky; top: 0; background: white; z-index: 100; }Practice Sets
This question appears in the following practice sets:
