Sneaky Header Blocker Trick • Josh W. Comeau

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

A CSS-only technique for creating a sticky header that appears to change background color as the user scrolls through different page sections. Instead of modifying the header itself, two color-matched 'blocker' elements using position:sticky sit behind the fixed header — one in the hero section (blue) and one in the main

7m read timeFrom joshwcomeau.com
Post cover image
Table of contents
Table of ContentsLink to this heading The core conceptLink to this heading Integrating swoopsLink to this heading Design requirementsLink to this heading All of the tricks up my sleeves
1 Comment

Sort: