web-design-guidelines

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Web Design Guidelines

Web 设计指南

属于 Agent Skills™ 的组成部分,由 googleadsagent.ai™ 提供

Description

描述

Web Design Guidelines encodes 100+ rules covering accessibility, focus states, forms, animation, typography, images, performance, navigation, dark mode, touch targets, and internationalization. The agent applies these rules when generating UI code, reviewing designs, or building new pages, producing interfaces that are accessible, performant, and visually consistent by default.
These guidelines synthesize WCAG 2.2 AA requirements, platform-specific HIG conventions, and empirically validated UX patterns into a single actionable ruleset. Rather than treating accessibility as an afterthought or a compliance checkbox, these rules embed it into the generation process: every component is keyboard-navigable, every image has alt text, every color combination meets contrast ratios, and every interactive element has visible focus indicators.
The rules extend beyond accessibility into comprehensive design quality: responsive typography scales, motion preferences, form validation patterns, image optimization, navigation hierarchy, dark mode implementation, touch-friendly sizing, and RTL/i18n support. The result is production-grade UI code that works for all users across all contexts.
Web 设计指南包含 100 多条规则,涵盖无障碍、焦点状态、表单、动画、排版、图像、性能、导航、暗色模式、触控目标和国际化。Agent 会在生成 UI 代码、审查设计或构建新页面时应用这些规则,默认产出无障碍、性能良好且视觉一致的界面。
这些指南将 WCAG 2.2 AA 要求、平台特定的 HIG 规范和经过实证验证的 UX 模式整合为一套可执行的规则集。它们不会将无障碍视为事后补充或合规勾选项,而是将其嵌入生成流程:每个组件都可通过键盘导航,每张图像都有 alt text,每种颜色组合都满足对比度要求,每个交互元素都有可见的焦点指示器。
这些规则不仅涵盖无障碍,还扩展到全面的设计质量:响应式排版缩放、动态效果偏好、表单验证模式、图像优化、导航层级、暗色模式实现、触控友好尺寸,以及 RTL/i18n 支持。最终产出的是生产级 UI 代码,能够适应各种用户和不同使用环境。

Use When

使用场景

  • Generating new UI components or pages
  • Reviewing frontend code for accessibility compliance
  • Implementing dark mode or theme switching
  • Building forms with validation
  • Adding animations or transitions
  • Optimizing images and media
  • Supporting internationalization or RTL layouts
  • 生成新的 UI 组件或页面
  • 审查前端代码的无障碍合规性
  • 实现暗色模式或主题切换
  • 构建带验证功能的表单
  • 添加动画或过渡效果
  • 优化图像和媒体
  • 支持国际化或 RTL 布局

How It Works

工作原理

mermaid
graph TD
    A[UI Code Generation] --> B[Apply Rule Categories]
    B --> C[Accessibility: WCAG 2.2 AA]
    B --> D[Focus States: Visible + Logical]
    B --> E[Forms: Validation + Labels]
    B --> F[Animation: prefers-reduced-motion]
    B --> G[Typography: Fluid Scale]
    B --> H[Images: Responsive + Alt Text]
    B --> I[Performance: Lazy Load + CLS]
    B --> J[Navigation: Keyboard + Hierarchy]
    B --> K[Dark Mode: System Preference]
    B --> L[Touch: 44px Min Target]
    B --> M[i18n: RTL + Locale]
    C --> N[Validated UI Output]
    D --> N
    E --> N
    F --> N
    G --> N
    H --> N
    I --> N
    J --> N
    K --> N
    L --> N
    M --> N
Every generated component passes through all applicable rule categories before output. Rules are non-negotiable for accessibility; other categories are applied based on component type.
mermaid
graph TD
    A[UI Code Generation] --> B[Apply Rule Categories]
    B --> C[Accessibility: WCAG 2.2 AA]
    B --> D[Focus States: Visible + Logical]
    B --> E[Forms: Validation + Labels]
    B --> F[Animation: prefers-reduced-motion]
    B --> G[Typography: Fluid Scale]
    B --> H[Images: Responsive + Alt Text]
    B --> I[Performance: Lazy Load + CLS]
    B --> J[Navigation: Keyboard + Hierarchy]
    B --> K[Dark Mode: System Preference]
    B --> L[Touch: 44px Min Target]
    B --> M[i18n: RTL + Locale]
    C --> N[Validated UI Output]
    D --> N
    E --> N
    F --> N
    G --> N
    H --> N
    I --> N
    J --> N
    K --> N
    L --> N
    M --> N
输出前,每个生成的组件都会经过所有适用规则类别的检查。对于无障碍规则不允许妥协;其他类别则根据组件类型应用。

Implementation

实现

css
/* Focus: Always visible, high contrast */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Animation: Respect user preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Typography: Fluid responsive scale */
:root {
  --step-0: clamp(1rem, 0.34vw + 0.91rem, 1.19rem);
  --step-1: clamp(1.2rem, 0.61vw + 1.07rem, 1.58rem);
  --step-2: clamp(1.44rem, 0.98vw + 1.24rem, 2.11rem);
}

/* Dark mode: System preference + manual toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a;
    --fg: #ededed;
  }
}

/* Touch: Minimum 44px targets */
button, a, [role="button"] {
  min-height: 44px;
  min-width: 44px;
}
tsx
// Form: Accessible label + validation + error association
function EmailField({ error }: { error?: string }) {
  const id = useId();
  return (
    <div>
      <label htmlFor={id}>Email address</label>
      <input
        id={id}
        type="email"
        aria-invalid={!!error}
        aria-describedby={error ? `${id}-error` : undefined}
        autoComplete="email"
      />
      {error && <p id={`${id}-error`} role="alert">{error}</p>}
    </div>
  );
}
css
/* Focus: Always visible, high contrast */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Animation: Respect user preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Typography: Fluid responsive scale */
:root {
  --step-0: clamp(1rem, 0.34vw + 0.91rem, 1.19rem);
  --step-1: clamp(1.2rem, 0.61vw + 1.07rem, 1.58rem);
  --step-2: clamp(1.44rem, 0.98vw + 1.24rem, 2.11rem);
}

/* Dark mode: System preference + manual toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a;
    --fg: #ededed;
  }
}

/* Touch: Minimum 44px targets */
button, a, [role="button"] {
  min-height: 44px;
  min-width: 44px;
}
tsx
// Form: Accessible label + validation + error association
function EmailField({ error }: { error?: string }) {
  const id = useId();
  return (
    <div>
      <label htmlFor={id}>Email address</label>
      <input
        id={id}
        type="email"
        aria-invalid={!!error}
        aria-describedby={error ? `${id}-error` : undefined}
        autoComplete="email"
      />
      {error && <p id={`${id}-error`} role="alert">{error}</p>}
    </div>
  );
}

Best Practices

最佳实践

  • Test every page with keyboard-only navigation before shipping
  • Maintain a minimum 4.5:1 contrast ratio for normal text, 3:1 for large text
  • Use semantic HTML elements before reaching for ARIA attributes
  • Provide visible focus indicators that work on both light and dark backgrounds
  • Set explicit
    width
    and
    height
    on images to prevent CLS
  • Support
    prefers-reduced-motion
    ,
    prefers-color-scheme
    , and
    prefers-contrast
  • 发布前,使用纯键盘导航测试每个页面
  • 普通文本的最低对比度保持 4.5:1,大文本保持 3:1
  • 优先使用语义化 HTML 元素,然后才使用 ARIA 属性
  • 提供在浅色和深色背景上都能清晰显示的焦点指示器
  • 为图像明确设置
    width
    和
    height
    ,防止 CLS
  • 支持
    prefers-reduced-motion
    、
    prefers-color-scheme
    和
    prefers-contrast

Platform Compatibility

平台兼容性

PlatformSupportNotes
CursorFullCSS + JSX generation
VS CodeFullaxe-core integration
WindsurfFullAccessibility-aware output
Claude CodeFullHTML/CSS generation
ClineFullRule-based UI review
aiderPartialLimited design context
平台支持情况备注
Cursor完全支持CSS + JSX 生成
VS Code完全支持axe-core 集成
Windsurf完全支持支持无障碍的输出
Claude Code完全支持HTML/CSS 生成
Cline完全支持基于规则的 UI 审查
aider部分支持设计上下文有限

Related Skills

相关 Skill

  • Composition Patterns
  • React Best Practices
  • View Transitions
  • Edge Rendering
  • Composition Patterns
  • React Best Practices
  • View Transitions
  • Edge Rendering

Keywords

关键词

web-design
accessibility
wcag
dark-mode
responsive
typography
forms
focus-states
touch-targets
i18n
animation
performance

© 2026 googleadsagent.ai™ | Agent Skills™ | MIT License
web-design
accessibility
wcag
dark-mode
responsive
typography
forms
focus-states
touch-targets
i18n
animation
performance

© 2026 googleadsagent.ai™ | Agent Skills™ | MIT License