Header 04
A premium floating capsule header that hugs its own content, gains elevation on scroll, and expands its own shape into a stacked mobile panel.
Requirements
HTML, CSS, JavaScript
Dependencies
None
Usage
Copy index.html, styles.css and script.js into your project.
About Header 04
Header 04 is a header section in the Header Sections collection, available in HTML + CSS + JavaScript and React + TypeScript + Tailwind CSS. Last updated August 25, 2026.
- header
- floating
- capsule
- pill
- sticky
- scroll effect
- minimal
- saas
What the code includes
HTML + CSS + JavaScript
3 files: index.html, styles.css, script.js
- Behavior is handled in script.js.
- ARIA in the markup: aria-label, aria-expanded, aria-controls.
- HTML elements used: header, nav, button, img, svg.
- Keyboard keys handled: Escape.
- Includes a prefers-reduced-motion rule for its animation.
- Responsive CSS breakpoints at 1024px.
React + TypeScript + Tailwind CSS
3 files: Header04.jsx, Header04.types.ts, Header04.tailwind.css
- Typed data shapes: NavItem.
- Uses React hooks: useEffect, useRef, useState.
- ARIA in the markup: aria-label, aria-expanded, aria-controls.
- HTML elements used: header, nav, button, svg.
- Keyboard keys handled: Escape.
- Includes a prefers-reduced-motion rule for its animation.
- Responsive Tailwind breakpoints used: lg.