enhancing-progressively

thkt 的头像作者 thkt

CSS优先方法-在JavaScript之前使用CSS。触发器:布局, 样式, 位置, 动画, 显示/隐藏, 切换, 响应式, CSS Grid, Flexbox, 转换, 过渡, 仅CSS, 无需JavaScript, 简单

📖 中文导读:CSS优先方法-在JavaScript之前使用CSS。触发器:布局, 样式, 位置, 动画, 显示/隐藏, 切换, 响应式, CSS Grid, Flexbox, 转换, 过渡, 仅CSS, 无需JavaScript, 简单 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

name: enhancing-progressively description: > CSS-first approach - use CSS before JavaScript. Use when implementing layouts, animations, or toggles, or when user mentions レイアウト, スタイル, 位置, アニメーション, 表示/非表示, トグル, レスポンシブ, CSS Grid, Flexbox, transforms, transitions, CSSのみ, JavaScript不要, シンプル allowed-tools: [Read, Grep, Glob] user-invocable: false

Progressive Enhancement

Priority

Priority Approach Examples
1 HTML Semantic elements, native inputs
2 CSS Grid, Flexbox, :has(), transitions
3 JS Only when truly necessary

Detection

JS Pattern CSS Alternative
element.style.display CSS :has(), [open], <dialog>
addEventListener('resize') CSS @media, clamp(), min()
getBoundingClientRect CSS Grid, Flexbox, gap
setInterval for animation CSS transition, @keyframes
classList.toggle CSS :checked, :target
scrollTo, scrollIntoView CSS scroll-behavior: smooth
matchMedia CSS @media, @container