Loading...
Loading...
Proactively apply when creating design systems, component libraries, or any frontend application. Triggers on CSS Grid, Subgrid, Flexbox, Container Queries, :has(), @layer, @scope, CSS nesting, @property, @function, if(), oklch, color-mix, light-dark, relative color, @starting-style, scroll-driven animations, view transitions, anchor positioning, popover, customizable select, content-visibility, logical properties, text-wrap, interpolate-size, clamp, field-sizing, modern CSS, CSS architecture, responsive design, dark mode, theming, design tokens, cascade layers. Use when writing CSS for any web project, choosing layout approaches, building responsive components, implementing dark mode or theming, creating animations or transitions, styling form elements, or modernizing legacy stylesheets. Modern CSS features and best practices for building interfaces with pure native CSS.
npx skill4agent add ccheney/robust-skills modern-css| Use Freely (Baseline) | Feature-Detect First |
|---|---|
| CSS Grid, Subgrid, Flexbox | |
| Container Queries (size + style) | Customizable |
| Scroll-state queries (Chrome-only) |
CSS Nesting, | |
| |
| Typed |
| Relative color syntax | |
| |
| Scroll-driven animations | Grid Lanes / masonry (experimental) |
| Anchor positioning, Popover API | |
| |
| View Transitions, logical properties |
@layer@scopeStyle Resolution Order (highest priority wins):
┌─────────────────────────────────────────────────┐
│ 1. Transitions (active transition wins) │
│ 2. !important (user-agent > user > author) │
│ 3. @layer order (later layer > earlier layer) │
│ 4. Unlayered styles (beat ALL layers) │
│ 5. Specificity (ID > class > element) │
│ 6. @scope proximity (closer root wins) NEW │
│ 7. Source order (later > earlier) │
└─────────────────────────────────────────────────┘
Unlayered > Last layer > ... > First layer
(utilities) (reset)@layer@scope@layer reset, base, components, utilities;Layout approach?
├─ 2D grid (rows + columns) → CSS Grid
│ ├─ Children must align across → Grid + Subgrid
│ └─ Waterfall / masonry → grid-lanes (experimental)
├─ 1D row OR column → Flexbox
├─ Component adapts to container → Container Query + Grid/Flex
├─ Viewport-based responsiveness → @media range syntax
└─ Element sized to content → fit-content / min-content / stretchStyle based on what?
├─ Child/descendant presence → :has()
├─ Container size → @container (inline-size)
├─ Container custom property → @container style()
├─ Scroll position (stuck/snapped) → scroll-state() query
├─ Element's own custom property → if(style(...))
├─ Browser feature support → @supports
├─ User preference (motion/color) → @media (prefers-*)
└─ Multiple selectors efficiently → :is() / :where()Animation type?
├─ Enter/appear on DOM → @starting-style + transition
├─ Exit/disappear (display:none) → transition-behavior: allow-discrete
├─ Animate to/from auto height → interpolate-size: allow-keywords
├─ Scroll-linked (parallax/reveal) → animation-timeline: scroll()/view()
├─ Page/view navigation → View Transitions API
├─ Custom easing (bounce/spring) → linear() function
└─ Always: respect user preference → @media (prefers-reduced-motion)| JavaScript Pattern | CSS Replacement |
|---|---|
| Scroll position listeners | Scroll-driven animations |
| IntersectionObserver for reveal | |
| Sticky header shadow toggle | |
| Floating UI / Popper.js | Anchor positioning |
| Carousel prev/next/dots | |
| Auto-expanding textarea | |
| Staggered animation delays | |
| |
| Parent element selection | |
| Theme toggle logic | |
| Tooltip/popover show/hide | Popover API + invoker commands |
| Color manipulation functions | |
| Anti-Pattern | Problem | Fix |
|---|---|---|
Overusing | Specificity arms race | Use |
Deep nesting ( | Fragile, DOM-coupled | Flat selectors, |
IDs for styling ( | Too specific to override | Classes ( |
| Viewport-coupled, not reusable | Container queries |
| JS scroll listeners for effects | Janky, expensive | Scroll-driven animations |
| JS for tooltip positioning | Floating UI dependency | Anchor positioning |
| JS for carousel controls | Fragile, a11y issues | |
| JS for auto-expanding textarea | Unnecessary complexity | |
| Wrong duration, janky | |
| Breaks in RTL/vertical | Logical properties ( |
| Legacy syntax | |
| Removes ALL functionality | |
| Preprocessor-only variables | Can't change at runtime | CSS custom properties |
| Preprocessor-only nesting | Extra build step dependency | Native CSS nesting |
| Preprocessor color functions | Can't respond to context | |
| Performance-heavy | Only headings/short text |
| Delays LCP rendering | Only off-screen sections |
Overusing | Wastes GPU memory | Apply only to animating elements |
| File | Purpose |
|---|---|
| references/CASCADE.md | Nesting, |
| references/LAYOUT.md | Grid, Subgrid, Flexbox, Container Queries, and intrinsic sizing |
| references/SELECTORS.md | |
| references/COLOR.md | OKLCH, |
| references/TOKENS.md | |
| references/ANIMATION.md | |
| references/SCROLL.md | Scroll-driven animations, scroll-state queries, native carousels |
| references/COMPONENTS.md | Customizable |
| references/PERFORMANCE.md | |
| references/CHEATSHEET.md | Quick reference: browser support, legacy→modern patterns, units |
if()random()sibling-index/count()@function@mixin