- Home
- Skills
- Frontend & Web Apps
- CSS Clamp – fluid typography and spacing
CSS Clamp – fluid typography and spacing
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
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).
| Token | Min | Max | Value |
|---|---|---|---|
| body | 16px | 18px | clamp(1rem, 0.958rem + 0.185vw, 1.125rem) |
| h3 | 20px | 28px | clamp(1.25rem, 1.083rem + 0.741vw, 1.75rem) |
| h2 | 24px | 40px | clamp(1.5rem, 1.167rem + 1.481vw, 2.5rem) |
| h1 | 36px | 64px | clamp(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.
Does not handle layout structural changes like column counts. Requires Node.js for the calculation script, otherwise falls back to manual formula application.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
2 uses
Times used to date
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 2 months ago
- Free with an Agensi account
Permissions
What's inside
Creator
Willem-Jaap Klepper
Frequently Asked Questions
New in Frontend & Web Apps
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Frontend & Web Apps.