sticky-and-fixed-elements
Skill194 starsChanged 4 months agoMITView on GitHub
Sticky headers, bottom toolbars, floating action buttons and pinned table headers. Use when deciding what stays on screen while the user scrolls.
In this repository44 other files it gives its agents.
- algorithmic-color-paletteSkill
- app-shellSkill
- authentic-product-representationSkill
- brand-visual-languageSkill
- button-statesSkill
- clone-websiteSkill
- color-mode-and-themeSkill
- component-family-consistencySkill
- coordinated-data-viewsSkill
- data-display-and-selectionSkill
- dembrandtSkill
- domain-expert-configurationSkill
- elevation-and-depthSkill
- extract-designSkill
- form-designSkill
- generate-ui-from-brandSkill
- gestalt-ui-organisationSkill
- global-toolbar-controlsSkill
- information-architectureSkill
- layout-paradigms-and-consistencySkill
- loading-states-and-perceived-performanceSkill
- marketing-vs-product-systemSkill
- micro-interactionsSkill
- modal-and-overlay-patternsSkill
- modular-scale-typographySkill
- motion-and-storytellingSkill
- nielsen-usability-heuristicsSkill
- notifications-and-recoverySkill
- operational-expert-tool-uiSkill
- performance-and-web-vitalsSkill
- real-world-metaphorsSkill
- repeated-component-alignmentSkill
- responsive-paradigmsSkill
- scroll-areasSkill
- semantic-html-and-seoSkill
- sizing-unitsSkill
- status-colors-and-errorsSkill
- surface-separationSkill
- tab-navigationSkill
- ui-context-and-scopeSkill
- ui-densitySkill
- user-flows-and-guided-pathsSkill
- visual-emphasis-and-hierarchySkill
- wcag-accessibilitySkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 53
Prefer
stickyoverfixed: when the element belongs to a specific section or scroll context. - Distinctive: line 94
Use icons with labels for navigation tabs, or icons alone for contextual toolbars (with tooltips)
- Very specific: line 111
If the table also has a sticky first column (for row identifiers), the top-left cell needs both top: 0 and left: 0, and a higher z-index to …
- Very specific: line 126
Every fixed or sticky element must declare its z-index explicitly using a token.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Sticky and Fixed Elements
position: fixed vs position: sticky
| Property | Behaviour | Use for |
position: fixed | Removed from document flow. Always stays at the same viewport position regardless of scroll or parent. | Global navigation header, bottom toolbar, floating action button |
position: sticky | Stays in document flow until it hits its scroll threshold, then locks in place. Returns to flow when parent scrolls past. | Table column headers, section headings in a long list, in-page toolbars within a scroll container |
Prefer sticky over fixed when the element belongs to a specific section or scroll context. Fixed elements sit above everything and affect the entire viewport — use them only for truly global UI.
Top — Navigation Header
The global navigation header is the most common fixed element. It should:
- Remain visible at all times so the user can always navigate away
- Be as thin as possible to maximise content area — 48–64px is a common range
- Have a background and shadow so content scrolling beneath it does not bleed through
- On scroll, a subtle shadow (
--shadow-sm) signals that content is behind it
.site-header {
position: fixed;
top: 0;
left: 0;
right: 0;
height: var(--header-height);
background: var(--color-surface);
box-shadow: var(--shadow-sm);
z-index: var(--z-header);
}Compensate for the fixed header with matching top padding on the page body:
body { padding-top: var(--header-height); }Bottom — Toolbar on Mobile
On mobile, the bottom of the screen is the most reachable area with one thumb. A persistent bottom toolbar is the natural home for:
- Primary navigation (bottom tab bar — iOS and Android convention)
- Contextual actions for the current view (edit, share, delete)
- A floating action button (FAB) for the single most important action
Bottom toolbars should:
- Respect the safe area inset on devices with a home indicator:
padding-bottom: env(safe-area-inset-bottom) - Be visually separated from content (background fill, top border, or shadow)
- Contain 3–5 items maximum — more than 5 should move to a menu or a different pattern
- Use icons with labels for navigation tabs, or icons alone for contextual toolbars (with tooltips)
On desktop, bottom toolbars are uncommon. Status bars, editor toolbars, and command palettes are the desktop equivalent — these are typically position: fixed at the bottom or position: sticky within their scroll container.
Sticky Table Headers
For data tables inside a scroll container, sticky column headers prevent the user from losing track of what each column means.
thead th {
position: sticky;
top: 0;
background: var(--color-surface);
z-index: 1;
}If the table also has a sticky first column (for row identifiers), the top-left cell needs both top: 0 and left: 0, and a higher z-index to sit above both the header row and the sticky column.
Stacking and Z-index
Sticky and fixed elements create stacking context. Define z-index as named tokens, not arbitrary numbers:
--z-base: 0;
--z-dropdown: 100;
--z-sticky: 200;
--z-header: 300;
--z-modal: 400;
--z-toast: 500;Every fixed or sticky element must declare its z-index explicitly using a token. Avoid ad-hoc values like z-index: 9999 — they signal an unmanaged stacking context and will eventually conflict.
How Many Fixed Layers Is Too Many
Each fixed layer removes space from the content area and adds visual complexity. A page should rarely need more than:
- 1 fixed header (top)
- 1 fixed toolbar or bottom nav (bottom, mobile)
- 1 floating action button or contextual overlay
A fixed header + fixed bottom toolbar + floating button + sticky sidebar + sticky table header all simultaneously is too many layers. Consolidate where possible.
Review Checklist
- Is
stickyused for section-scoped elements andfixedonly for truly global UI? - Does the fixed header compensate for its height with body padding?
- Does the bottom toolbar respect
env(safe-area-inset-bottom)on mobile? - Are all z-index values defined as named tokens, not arbitrary numbers?
- Is the total number of simultaneous fixed layers minimal — header + one bottom element maximum in most cases?
- Does content scrolling behind a fixed element not visually bleed through (background + shadow on the fixed element)?
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

