sticky-and-fixed-elements — скилл для Claude Code: липкие
Помогает решить, что остаётся на экране при прокрутке: липкие заголовки, нижние панели, плавающие кнопки, закреплённые шапки таблиц.
npx skills add dembrandt/dembrandt-skills --skill sticky-and-fixed-elements -a claude-codeЧто делает sticky-and-fixed-elements
Скилл разбирает разницу между position: fixed и position: sticky и подсказывает, какой вариант брать под конкретный элемент. Фиксированные элементы выпадают из потока документа и висят в одной точке вьюпорта — это для глобальной навигации, нижней панели и плавающей кнопки. Липкие остаются в потоке, пока не дойдут до порога прокрутки, и подходят для шапок таблиц и заголовков секций внутри скролл-контейнера.
Внутри — готовые куски CSS: шапка сайта с компенсацией высоты через padding-top у body, липкий thead th, набор именованных токенов z-index вместо случайных чисел вроде z-index: 9999. Отдельный раздел про то, сколько фиксированных слоёв терпит страница: обычно один сверху, один снизу на мобильном и одна плавающая кнопка. Больше — уже перебор, и это повод проверить, не пора ли что-то объединить.
Есть чек-лист для ревью: учитывает ли нижняя панель env(safe-area-inset-bottom), не просвечивает ли контент под фиксированным блоком, объявлен ли z-index токеном. Скилл подхватывается по путям вроде **/*.css, **/*.tsx и components/**, поэтому срабатывает, когда вы правите стили или компоненты.
Какие задачи решает
- выбрать между
stickyиfixedдля шапки сайта - сделать липкую шапку таблицы внутри скролл-контейнера
- спроектировать нижнюю панель навигации для мобильного
- добавить плавающую кнопку основного действия
- развести
z-indexпо именованным токенам вместо магических чисел
Примеры запросов агенту
- Шапка должна быть sticky или fixed — что тут уместнее?
- Спроектируй нижний тулбар для мобильной версии с учётом safe area
- Сделай заголовки таблицы липкими при прокрутке
Как установить sticky-and-fixed-elements
1Через Skills CLI (Vercel)
npx skills add dembrandt/dembrandt-skills --skill sticky-and-fixed-elements -a claude-code2Вручную: положить файлы
~/.claude/skills/sticky-and-fixed-elements/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/sticky-and-fixed-elements/
1Через Skills CLI (Vercel)
npx skills add dembrandt/dembrandt-skills --skill sticky-and-fixed-elements -a codex2Вручную: положить файлы
.agents/skills/sticky-and-fixed-elements/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add dembrandt/dembrandt-skills --skill sticky-and-fixed-elements -a cursor2Вручную: положить файлы
.cursor/skills/sticky-and-fixed-elements/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install dembrandt/dembrandt-skills sticky-and-fixed-elements2Вручную: положить файлы
.github/skills/sticky-and-fixed-elements/SKILL.md1Через Skills CLI (Vercel)
npx skills add dembrandt/dembrandt-skills --skill sticky-and-fixed-elements -a gemini-cli2Командой платформы
gemini skills install https://github.com/dembrandt/dembrandt-skills --path skills/sticky-and-fixed-elementsВручную: положить файлы
.devin/skills/sticky-and-fixed-elements/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add dembrandt/dembrandt-skills --skill sticky-and-fixed-elements -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о sticky-and-fixed-elements
Как установить sticky-and-fixed-elements в Claude?
Выполните npx skills add dembrandt/dembrandt-skills --skill sticky-and-fixed-elements -a claude-code. Файл скилла окажется по пути ~/.claude/skills/sticky-and-fixed-elements/SKILL.md.
Что делает sticky-and-fixed-elements?
Подсказывает, какие элементы интерфейса оставить на экране при прокрутке и как их правильно сверстать. Внутри — сравнение fixed и sticky, примеры CSS и чек-лист для ревью.
Когда брать sticky, а когда fixed?
sticky — для элементов внутри конкретной секции или скролл-контейнера, например шапок таблиц. fixed — только для глобального интерфейса: навигации, нижней панели, плавающей кнопки.
Исходный текст
SKILL.md · MIT
---
name: sticky-and-fixed-elements
description: Sticky headers, bottom toolbars, floating action buttons and pinned table headers. Use when deciding what stays on screen while the user scrolls.
metadata:
priority: 6
pathPatterns:
- "**/*.css"
- "**/*.scss"
- "components/**"
- "src/components/**"
- "**/*.tsx"
- "**/*.jsx"
- "design-system/**"
promptSignals:
phrases:
- "sticky"
- "fixed"
- "position: fixed"
- "position: sticky"
- "toolbar"
- "bottom bar"
- "floating"
- "persistent header"
retrieval:
aliases:
- sticky header
- fixed toolbar
- bottom navigation
- floating action button
- sticky table header
- persistent UI
intents:
- keep header visible on scroll
- design a bottom toolbar
- add a floating action button
- make table headers sticky
- decide between sticky and fixed
examples:
- should the header be sticky or fixed
- design a bottom toolbar for mobile
- keep this toolbar visible while scrolling
---
# 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
```css
.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:
```css
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.
```css
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:
```css
--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 `sticky` used for section-scoped elements and `fixed` only 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)?
© dembrandt · MIT · dembrandt/dembrandt-skills