Deft
Ask AI

Search

Search skills, authors and topics

jakubkrehel / skills

better-typography

Web typography from choosing fonts to spacing, wrapping and accessibility. Use when picking or pairing typefaces, configuring variable fonts or OpenType features, setting up a type scale, styling text in components, truncating text, styling underlines, selection, placeholders or carets, or reviewing frontend code for typography. Triggers on typography, fonts, font formats, woff2, variable fonts, font-weight, opentype, font-feature-settings, letter-spacing, line-height, type scale, tabular numbers, text-wrap, truncation, line clamp, underlines, text-decoration, text selection, iOS input zoom, font smoothing, text contrast, measure, line length, text-box, smart punctuation, drop cap.

Install

npx skills add https://github.com/jakubkrehel/skills --skill better-typography

CSS cheat sheet

One-line lookup for every typography CSS declaration covered by this skill, with the Tailwind 4 equivalent. Where no utility exists, the arbitrary-value form is shown. Pick the column that matches the project: the declaration in plain CSS, CSS Modules, styled-components or StyleX codebases, the utility in Tailwind codebases.

Font

DeclarationWhat it doesTailwind
font-family: sans-serifThe sans familyfont-sans
font-family: serifThe serif familyfont-serif
font-family: monospaceThe monospace familyfont-mono
font-sizeSize from the type scaletext-*
font-weightAny value from 1 to 1000font-*
font-style: italicSwitch to italic styleitalic
-webkit-font-smoothing + -moz-osx-font-smoothingSmooth macOS font rendering; apply once at the rootantialiased
font-synthesis: noneDisable all synthesized forms after verifying fallbacks and emphasis[font-synthesis:none]
font-feature-settingsToggle OpenType features[font-feature-settings:"ss01"]
font-variation-settingsTune variable font axes[font-variation-settings:"GRAD"_80]
font-optical-sizing: autoOptical size follows font size; the default, so leave itnone needed
font-variant-capsReal small capitals[font-variant-caps:small-caps]
font-variant-positionReal super and subscripts[font-variant-position:super]
font-variant-numeric: tabular-numsEqual-width digitstabular-nums
font-variant-numeric: slashed-zeroTell 0 from Oslashed-zero

Spacing and layout

DeclarationWhat it doesTailwind
letter-spacingSpace between letterstracking-*
line-heightSpace between linesleading-*
font-kerningKerning on or off[font-kerning:none]
text-box: trim-bothTrim space above and below[text-box:trim-both_cap_alphabetic]
max-width on text columnsCap at ~60–75 characters per linemax-w-xl / max-w-2xl / max-w-prose
text-alignWhere lines start and endtext-start / text-center

Wrapping and overflow

DeclarationWhat it doesTailwind
text-wrap: balanceEven out heading linestext-balance
text-wrap: prettyKeep a lone word off the last linetext-pretty
text-overflow: ellipsisEllipsis for clipped texttext-ellipsis
overflow: hidden + text-overflow: ellipsis + white-space: nowrapSingle-line truncationtruncate
-webkit-line-clamp + display: -webkit-box + -webkit-box-orient: vertical + overflow: hiddenCut off after N linesline-clamp-*
overflow-wrap: break-wordBreak long stringsbreak-words
white-space: nowrapStop wrappingwhitespace-nowrap
text-transformChange the casinguppercase / capitalize
hyphens: autoHyphenate by the element's langhyphens-auto

Decoration and interaction

DeclarationWhat it doesTailwind
text-decoration-line: underlineDraw an underlineunderline
text-decoration-colorUnderline colordecoration-*
text-decoration-thicknessUnderline thicknessdecoration-1 / decoration-2
text-underline-offsetPush the line downunderline-offset-*
text-underline-position: from-fontUnderline position from the font[text-underline-position:from-font]
text-decoration-styleDotted, dashed or wavydecoration-dotted / decoration-wavy
text-decoration-thickness: from-fontUnderline set by the fontdecoration-from-font
text-decoration-skip-inkGaps around descenders; auto is the default[text-decoration-skip-ink:auto]
caret-colorTint the text cursorcaret-*
user-select: noneSuppress selection on a verified drag/gesture conflict onlyselect-none
text-shadowShadow behind the letterstext-shadow-*
-webkit-text-strokeOutline the letters[-webkit-text-stroke:1px_black]
background-clip: textClip a background to the lettersbg-clip-text
initial-letterSize a drop cap[initial-letter:3]