responsive-typography
БесплатноБез исполняемых скриптовНе проверенImplements fluid typography using CSS clamp() that scales with viewport. Use when creating responsive font sizes, viewport-aware headings, or type that adapts…
Об этом скилле
Responsive Typography
Overview
Implement fluid typography that scales smoothly between viewport sizes without breakpoints. Uses CSS clamp() to create type that's readable on mobile and properly sized on desktop, eliminating abrupt size jumps.
When to Use
- Creating typography that scales with viewport
- Avoiding multiple breakpoint-based font sizes
- Implementing fluid/responsive headings
- Setting up a fluid type scale for a design system
Quick Reference: Clamp Syntax
/* clamp(minimum, preferred, maximum) */
font-size: clamp(1rem, 2.5vw + 0.5rem, 2rem);
/* ↑min ↑scales with vw ↑max */
| Part | Purpose |
|---|---|
| Minimum | Smallest the text will ever be |
| Preferred | Scales with viewport (uses vw) |
| Maximum | Largest the text will ever be |
The Math
Fluid Type Formula
preferred = (slope × viewport) + intercept
Where:
- slope = (maxSize - minSize) / (maxViewport - minViewport)
- intercept = minSize - (slope × minViewport)
Example Calculation
For text that's 16px at 320px viewport and 20px at 1200px viewport:
slope = (20 - 16) / (1200 - 320) = 4 / 880 = 0.00454545
intercept = 16 - (0.00454545 × 320) = 14.545px
preferred = 0.454545vw + 14.545px
→ Convert to rem: 0.454545vw + 0.909rem
Result: clamp(1rem, 0.45vw + 0.91rem, 1.25rem)
Fluid Type Scale
CSS Custom Properties
:root {
/* Fluid type scale
* Min viewport: 320px
* Max viewport: 1200px
*/
/* Body text */
--font-size-sm: clamp(0.8rem, 0.17vw + 0.76rem, 0.875rem);
--font-size-base: clamp(1rem, 0.34vw + 0.91rem, 1.125rem);
--font-size-lg: clamp(1.125rem, 0.45vw + 1.01rem, 1.25rem);
/* Headings */
--font-size-xl: clamp(1.25rem, 0.91vw + 1.07rem, 1.5rem);
--font-size-2xl: clamp(1.5rem, 1.36vw + 1.23rem, 1.875rem);
--font-size-3xl: clamp(1.875rem, 1.82vw + 1.51rem, 2.25rem);
--font-size-4xl: clamp(2.25rem, 2.73vw + 1.7rem, 3rem);
--font-size-5xl: clamp(3rem, 4.55vw + 2.09rem, 4rem);
/* Display */
--font-size-display: clamp(3rem, 6.82vw + 1.64rem, 5rem);
}
Tailwind Config
// tailwind.config.js
module.exports = {
theme: {
fontSize: {
'sm': 'clamp(0.8rem, 0.17vw + 0.76rem, 0.875rem)',
'base': 'clamp(1rem, 0.34vw + 0.91rem, 1.125rem)',
'lg': 'clamp(1.125rem, 0.45vw + 1.01rem, 1.25rem)',
'xl': 'clamp(1.25rem, 0.91vw + 1.07rem, 1.5rem)',
'2xl': 'clamp(1.5rem, 1.36vw + 1.23rem, 1.875rem)',
'3xl': 'clamp(1.875rem, 1.82vw + 1.51rem, 2.25rem)',
'4xl': 'clamp(2.25rem, 2.73vw + 1.7rem, 3rem)',
'5xl': 'clamp(3rem, 4.55vw + 2.09rem, 4rem)',
'display': 'clamp(3rem, 6.82vw + 1.64rem, 5rem)',
},
},
};
JSON Tokens
{
"font": {
"size": {
"fluid": {
"sm": {
"value": "clamp(0.8rem, 0.17vw + 0.76rem, 0.875rem)",
"min": "0.8rem",
"max": "0.875rem"
},
"base": {
"value": "clamp(1rem, 0.34vw + 0.91rem, 1.125rem)",
"min": "1rem",
"max": "1.125rem"
},
"lg": {
"value": "clamp(1.125rem, 0.45vw + 1.01rem, 1.25rem)",
"min": "1.125rem",
"max": "1.25rem"
},
"xl": {
"value": "clamp(1.25rem, 0.91vw + 1.07rem, 1.5rem)",
"min": "1.25rem",
"max": "1.5rem"
},
"2xl": {
"value": "clamp(1.5rem, 1.36vw + 1.23rem, 1.875rem)",
"min": "1.5rem",
"max": "1.875rem"
},
"3xl": {
"value": "clamp(1.875rem, 1.82vw + 1.51rem, 2.25rem)",
"min": "1.875rem",
"max": "2.25rem"
},
"4xl": {
"value": "clamp(2.25rem, 2.73vw + 1.7rem, 3rem)",
"min": "2.25rem",
"max": "3rem"
},
"5xl": {
"value": "clamp(3rem, 4.55vw + 2.09rem, 4rem)",
"min": "3rem",
"max": "4rem"
}
}
}
}
}
Fluid Scale Generator
JavaScript Function
/**
* Generate a fluid font-size clamp value
*
* @param {number} minSize - Minimum size in px
* @param {number} maxSize - Maximum size in px
* @param {number} minVw - Minimum viewport in px (default: 320)
* @param {number} maxVw - Maximum viewport in px (default: 1200)
* @returns {string} CSS clamp() value
*/
function fluidType(minSize, maxSize, minVw = 320, maxVw = 1200) {
const minSizeRem = minSize / 16;
const maxSizeRem = maxSize / 16;
const slope = (maxSize - minSize) / (maxVw - minVw);
const slopeVw = (slope * 100).toFixed(2);
const intercept = minSize - slope * minVw;
const interceptRem = (intercept / 16).toFixed(2);
return `clamp(${minSizeRem}rem, ${slopeVw}vw + ${interceptRem}rem, ${maxSizeRem}rem)`;
}
// Usage
fluidType(16, 20); // "clamp(1rem, 0.45vw + 0.91rem, 1.25rem)"
fluidType(24, 48); // "clamp(1.5rem, 2.73vw + 0.95rem, 3rem)"
Generate Full Scale
const scale = {
sm: fluidType(12.8, 14),
base:
Установить responsive-typography в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл responsive-typography?
Implements fluid typography using CSS clamp() that scales with viewport. Use when creating responsive font sizes, viewport-aware headings, or type that adapts smoothly without breakpoints.
Как установить скилл responsive-typography?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл responsive-typography запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic