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 tools 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
    • Generated the design tokens stylesheet

    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.

    css-clamp-fluid-typography-and-spacing-tokens.css

    CSS · design tokens

    Generated

    Example file from a real run - the skill writes it into your workspace.

    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 install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    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 3 days ago

    • Free to download with an account

    Listed3 days ago

    What's inside

    Frequently Asked Questions