CSS Clamp – fluid typography and spacing

    1

    Generate fluid CSS clamp() values for font sizes, spacing and type scales. Includes a script that does the maths, so values are exact and accessible (rem-based, zoom-safe). Works with plain CSS and Tailwind CSS.

    Free

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+22 more

    CSS Clamp – fluid typography and spacing

    Example session with this skill installed

    Make my headings fluid between 360px and 1440px viewports: body 16px to 18px, h3 20px to 28px, h2 24px to 40px, h1 36px to 64px. Give me Tailwind CSS v4 @theme tokens.

    • Read your context and instructions
    • Compiled the css clamp

    Ran node scripts/clamp.mjs for each size between 360px and 1440px. Bounds and intercepts are in rem, so the text still scales with browser zoom, and every max stays under 2.5x its min (WCAG 1.4.4).

    TokenMinMaxValue
    body16px18pxclamp(1rem, 0.958rem + 0.185vw, 1.125rem)
    h320px28pxclamp(1.25rem, 1.083rem + 0.741vw, 1.75rem)
    h224px40pxclamp(1.5rem, 1.167rem + 1.481vw, 2.5rem)
    h136px64pxclamp(2.25rem, 1.667rem + 2.593vw, 4rem)
    @import "tailwindcss";
    
    @theme {
      --text-body: clamp(1rem, 0.958rem + 0.185vw, 1.125rem);
      --text-h3: clamp(1.25rem, 1.083rem + 0.741vw, 1.75rem);
      --text-h2: clamp(1.5rem, 1.167rem + 1.481vw, 2.5rem);
      --text-h1: clamp(2.25rem, 1.667rem + 2.593vw, 4rem);
    }
    

    Use them as text-body, text-h3, text-h2 and text-h1, for example <h1 class="text-h1 font-bold">.

    Check: at 360px the h1 is 1.667rem + 2.593vw = 26.67px + 9.33px = 36px. At 1440px it is 26.67px + 37.34px = 64px.

    Next steps: pair each size with a line height (around 1.1 to 1.2 for headings), and for components inside a sidebar or card, rerun with --unit cqi so they scale with their container instead of the viewport.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Teaches AI coding agents to generate correct, accessible CSS clamp() values for fluid typography, spacing and complete type scales. The agent runs a bundled Node script instead of doing the maths by hand. It follows accessibility rules (rem bounds, no bare vw for text, the 2.5x zoom rule for WCAG 1.4.4) and outputs plain CSS, custom properties or Tailwind CSS v3/v4 tokens.

    How to use

    Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free forever

    No account required to browse

    Trust & safety

    Security scanned

    Verified clean 14 days ago

    • Free to download with an account

    Listed14 days ago

    What's inside

    Frequently Asked Questions