본문으로 건너뛰기
cccskills
무료GitHub에 공개

sticky-and-fixed-elements

Sticky headers, bottom toolbars, floating action buttons and pinned table headers. Use when deciding what stays on screen while the user scrolls.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md5.4 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Sticky and Fixed Elements

position: fixed vs position: sticky

PropertyBehaviourUse for
position: fixedRemoved from document flow. Always stays at the same viewport position regardless of scroll or parent.Global navigation header, bottom toolbar, floating action button
position: stickyStays 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 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)?

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Derive a full UI palette from one or two brand colours — state variants, brand-tinted greys, semantic colours. Use when building or expanding a colour system.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dembrandt/dembrandt-skills1472026년 10월 22일 업데이트

app-shell

무료

Top bar, sidebar rail, app launcher, tenant and environment cue, status bar. Use when designing the persistent shell, a collapsible sidebar, or navigation between apps behind one login.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dembrandt/dembrandt-skills1472026년 10월 22일 업데이트

Product visuals must show the real product with real data. Use when building landing pages, hero sections, screenshots or demo panels.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dembrandt/dembrandt-skills1472026년 10월 22일 업데이트

Shape language across type, radius and icons carries brand personality. Use when starting a design system, picking icons or radius tokens, or reviewing visual consistency.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dembrandt/dembrandt-skills1472026년 10월 22일 업데이트

Rest, hover, active, focus, disabled and loading states, derived from the base colour. Use when designing buttons, links, inputs or any clickable component.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dembrandt/dembrandt-skills1472026년 10월 22일 업데이트

Rebuild a live web page 1:1 from measurement into Figma, Penpot or code, then verify it. Use when reproducing a page or checking a rebuild against the original.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dembrandt/dembrandt-skills1472026년 10월 22일 업데이트

dembrandt의 스킬 모두 보기

이 스킬의 문제 신고