Welcome to Vanilla Breeze
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
Make header or footer elements stick to the viewport edge on scroll. CSS-only — no JavaScript required.
Add data-sticky to a <header> or <footer> element to pin it to the viewport edge as the user scrolls. Headers stick to the top; footers stick to the bottom.
This is a CSS-only attribute — no JavaScript required. It sets position: sticky, z-index: 100, and background: var(--color-surface) to ensure the element stays visible above scrolling content.
Pin a site header to the top of the viewport:
<header data-sticky> <strong>Brand</strong> <nav class="horizontal pills" aria-label="Site navigation"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Docs</a></li> </ul> </nav></header>
Pin a footer to the bottom of the viewport. Unlike position: fixed, a sticky footer is part of the normal document flow — it sticks to the bottom while you scroll but does not overlay content. Ideal for action bars, persistent CTAs, and form submit rows.
<footer data-sticky> <p>© 2026 Acme Co. All rights reserved.</p></footer>
| Element | Sticks to | CSS Applied |
|---|---|---|
<header data-sticky> |
Top of viewport | position: sticky; inset-block-start: 0 |
<footer data-sticky> |
Bottom of viewport | position: sticky; inset-block-end: 0 |
For a polished effect, add backdrop blur so content is visible behind the sticky header:
header[data-sticky] { backdrop-filter: blur(8px); background: oklch(from var(--color-surface) l c h / 0.9);}
Vanilla Breeze provides a coordinated sticky system activated by adding data-sticky to the <html> element. This gates all sticky behavior behind a single toggle, following the principle that sticky is an enhancement, not a default.
data-sticky or data-layout-sticky, but only activate when the system is enabled on <html>.--sticky-offset custom property flows the header height to all subordinate sticky elements automatically.<html data-sticky> <header data-sticky>...</header> <layout-sidebar> <nav data-layout-sticky>...</nav> <article>...</article> </layout-sidebar></html>
Or toggle via JavaScript:
document.documentElement.toggleAttribute('data-sticky');
The VB settings panel includes a Sticky Navigation toggle in the Layout section that manages this automatically with localStorage persistence.
When enabled, the sticky manager measures the header height and sets --sticky-offset on :root. All sticky sidebars and components reference this variable so they stack correctly below the header. The system also sets scroll-padding-block-start so anchor links land below the sticky header.
Sidebar elements with data-layout-sticky are always constrained to max-height: calc(100dvh - var(--sticky-offset) - var(--sticky-gap)) with overflow-y: auto. This ensures the sidebar fills exactly the remaining viewport below the header and gains inner scrolling when its content overflows. Combined with align-self: start, this is the pattern that keeps sticky positioning reliable regardless of content length.
On viewports narrower than 48rem, sticky headers are automatically disabled to preserve screen space. Sidebars collapse to drawers or stack layouts on mobile, so their sticky behavior does not apply.
A back-to-top button provides quick return-to-top navigation when sticky is off.
| Property | Default | Description |
|---|---|---|
--sticky-offset |
0px |
Set by sticky manager to the header height. Used by all subordinate sticky elements. |
--sticky-gap |
var(--size-2xs) |
Breathing room between the sticky header and subordinate sticky elements (sidebars, TOC). Override on :root or per-theme. |
--z-sticky |
100 |
Z-index for subordinate sticky elements (sidebars, page-toc, footer). |
--z-sticky-header |
200 |
Z-index for the sticky header. Higher than other sticky elements so dropdowns and overlays render above the page-toc. |
scroll-padding-block-start to offset anchor links below the sticky header<header> — Element that supports data-sticky for top positioning<footer> — Element that supports data-sticky for bottom positioning<table> — Uses data-sticky="header|column|both" for sticky rows and columns (different attribute)data-page-layout — Page layouts with data-layout-sticky support