Product design skills

css-cheat-sheet.md

A supporting file of the better-typography skill.

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-sizingAdjust details per size[font-optical-sizing:auto]
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-[65ch]
text-alignWhere lines start and endtext-start / text-center

Wrapping and overflow

DeclarationWhat it doesTailwind
text-wrap: balanceEven out heading linestext-balance
text-wrap: prettyAvoid orphaned wordstext-pretty
text-overflow: ellipsisEllipsis for clipped texttruncate
line-clampCut off after N linesline-clamp-*
overflow-wrap: break-wordBreak long stringsbreak-words
white-space: nowrapStop wrappingwhitespace-nowrap
text-transformChange the casinguppercase / capitalize

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[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]

On this page