Communitygithub.com

coastdigitalgroup/coastai-skills

Design and implement a typographic scale that scales smoothly across viewports using CSS clamp(). Trigger this skill when asked to create responsive typography, design systems, or fluid layouts.

What is coastai-skills?

coastai-skills is a Claude Code agent skill that design and implement a typographic scale that scales smoothly across viewports using CSS clamp(). Trigger this skill when asked to create responsive typography, design systems, or fluid layouts.

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/coastdigitalgroup/coastai-skills/tree/HEAD/website-design/fluid-typography-system

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Fluid Typography System

Purpose

The Fluid Typography System skill enables the creation of a typographic scale that adapts smoothly to the user's viewport size. Instead of jumping between fixed sizes at specific breakpoints, typography scales linearly between defined minimum and maximum values using the CSS clamp() function. This improves visual harmony, readability, and reduces the maintenance overhead of managing numerous media queries.

Use Cases

  • Building a responsive design system from scratch.
  • Modernizing an existing website's typography for better cross-device consistency.
  • Creating layouts where text needs to perfectly fill available space across all screen sizes.
  • Simplifying CSS by replacing multiple @media rules with a single set of fluid variables.

When NOT to Use

  • Legacy Browser Support: If the project must support browsers that do not understand clamp() (e.g., Internet Explorer).
  • Fixed-Width Designs: When the layout is strictly fixed and does not attempt to be responsive.
  • Extreme Precision: If specific brand guidelines mandate exact pixel sizes at every possible resolution that do not align with a linear scale.

Inputs

To generate a fluid typography system, you need:

  1. Viewport Range:
    • min-width: The screen width where scaling starts (e.g., 320px).
    • max-width: The screen width where scaling stops (e.g., 1200px).
  2. Base Font Size:
    • min-size: The body font size at min-width (e.g., 16px).
    • max-size: The body font size at max-width (e.g., 20px).
  3. Scale Ratio:
    • A multiplier to determine the size of headings (e.g., 1.250 for "Major Third", 1.333 for "Perfect Fourth").

Outputs

  1. CSS Custom Properties: A block of CSS variables defining the fluid scale.
  2. Typography Utility Classes: (Optional) CSS classes for easy application of the scale.
  3. Hierarchy Documentation: A clear mapping of sizes from Body to H1.

Workflow

1. Define the Scale Parameters

Determine the minimum and maximum viewports and the base sizes. Example: 320px to 1280px, 16px to 18px base.

2. Choose a Typographic Scale

Select a ratio that fits the brand's voice.

  • 1.067 (Minor Second): Subtle differences, good for dense data.
  • 1.200 (Minor Third): Standard, balanced.
  • 1.414 (Augmented Fourth): High contrast, bold headings.

3. Calculate Hierarchy Levels

Multiply the base size by the ratio for each level (H6 to H1). Formula: Size_level = Base * (Ratio ^ Level)

4. Generate Fluid Formulas

Convert the calculated min/max pixel values into a clamp() function. clamp(min, preferred, max)

The preferred value calculation: slope = (max_size - min_size) / (max_viewport - min_viewport) y_intercept = min_size - slope * min_viewport preferred = (y_intercept) + (slope * 100vw)

5. Implementation

Apply the generated CSS variables to the design.

Decision Rules

  • Accessibility First: The min-size for body text should rarely be below 1rem (16px).
  • User Preference: Always use rem units for the final output so user browser font-size settings are respected. Never use vw-only sizing without rem-based min/max clamping — pure viewport units ignore the user's browser zoom and font-size preferences and can fail WCAG 1.4.4 (Resize Text).
  • Scale Intensity: Use smaller ratios for mobile-heavy sites to prevent headings from becoming overly large on small screens.

Constraints

  • Responsiveness: Typography must remain within the bounds of its container without causing overflow.
  • Readability: Line length (measure) should ideally stay between 45-75 characters. Adjust container widths accordingly as text scales.
  • Hierarchy: H1 must always be visually distinct and larger than H2, which must be larger than H3, etc.

Common Failure Patterns

  • Incorrect Math: Resulting in text that shrinks when the screen gets larger.
  • Unit Mismatch: Mixing px and rem in ways that break browser zooming.
  • Over-scaling: Headings becoming so large on 4K monitors that they dominate the entire viewport.
  • Accessibility: Forgetting to test how the fluid scale behaves when a user zooms in or increases the OS/browser base font size (WCAG 1.4.4 Resize Text, WCAG 1.4.10 Reflow).

Validation Criteria

  • Typography scales smoothly when resizing the browser window.
  • No "jumps" or sudden size changes are visible.
  • All text is legible at 320px width.
  • Headings maintain a clear hierarchy relative to body text.
  • The system uses rem units for the base and clamp() for the fluid behavior.
  • Text reflows without loss of content or function at 400% browser zoom (WCAG 1.4.10 Reflow) and respects the user's font-size preference (WCAG 1.4.4).

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for progressive disclosure using accordions, ensuring structural integrity, visual affordances, and accessibility across different content densities and devices.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for long-form content, managing readability, vertical rhythm, and information density to ensure a superior reading experience.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for informational elements that communicate state (Badges) and categorization (Tags) with clarity and accessibility.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for non-overlay notifications, managing global announcements and contextual inline alerts to communicate system states without interrupting the user's flow.

coastdigitalgroup/coastai-skills

Design and implement a systematic, asymmetrical bento-grid layout framework to organize diverse content types cohesively while maintaining strict visual hierarchy, logical focus order, and responsive flexibility.

coastdigitalgroup/coastai-skills

Design a responsive, mobile-first bottom navigation bar and persistent action dock system for mobile websites and web applications, establishing spatial anchors, tab bar anatomy, badge indicators, thumb-zone ergonomics, safe area inset handling, active/inactive state contrast, and desktop responsive adaptation rules.

coastdigitalgroup/coastai-skills

Design a mobile-first bottom sheet overlay system with configurable detents, drag affordances, safe area padding, responsive desktop modal/popover adaptation, and WCAG AA accessibility compliance.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for secondary navigation trails that provide orientation, context, and one-click access to parent levels in deep information architectures.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for buttons and interactive triggers, managing visual hierarchy, variant logic, and action grouping to ensure clear intent and accessible interaction.

coastdigitalgroup/coastai-skills

Design a systematic framework for date and time selection, managing calendar grids, range pickers, and scheduling interfaces to ensure precision and accessibility.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for modular content containers that maintain hierarchy, structural integrity, and action alignment across variable content and responsive viewports.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for horizontal discovery components, managing navigation affordances, scroll behavior, and accessibility to ensure effective content density without compromising usability.

coastdigitalgroup/coastai-skills

Design a systematic, highly accessible, and developer-friendly UI layout framework for code blocks, snippet showcases, multi-file code tabs, line-highlighting, diff views, and syntax token contrast in technical documentation and developer platforms.

coastdigitalgroup/coastai-skills

Design a systematic framework for global command menus (Cmd+K panels) that combines keyboard-driven navigation, command execution, and shortcut discovery into an accessible, responsive overlay.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for threaded conversations, managing nesting depths, action hierarchies, and community signaling to foster engagement and readability.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for side-by-side comparison interfaces, managing high attribute density and responsive complexity to support informed decision-making.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for user privacy, managing consent banners, preference centers, and persistent privacy controls to balance legal compliance with user trust.

coastdigitalgroup/coastai-skills

Design and implement a systematic, highly accessible, and responsive visual layout framework for conversational chat widgets, live chat boxes, and chatbot panels that ensures clear message scannability, native focus flow, and seamless mobile keyboard adaptation.

coastdigitalgroup/coastai-skills

Design a systematic, accessible, and high-conversion framework for custom select dropdowns and comboboxes, defining anatomy, states, search-filtering, and responsive mobile-adaptive patterns.

coastdigitalgroup/coastai-skills

Design and implement a systematic color palette that ensures WCAG 2.2 accessibility compliance. Trigger this skill when asked to define brand colors, create UI themes, or establish a visual system for a website.

Related Skills