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-typographyDetails and accessibility
Underlines, selection, form text and decorative text.
Underlines
From the font's own metrics:
A dotted underline on an abbreviation:
Or tune manually:
Selection
::target-textstyles the phrase a shared link scrolls to.- The Custom Highlight API styles ranges you pick yourself, like search matches, without extra markup.
Forms and editable text
::placeholderstyles the hint in an empty field.caret-colorcolors the blinking insertion bar. A fully custom caret is hard to build and rarely worth it.
iOS input zoom
Size up on mobile. The input renders at 16px on small screens and drops to the design size from the sm breakpoint up. Nothing to compensate, but the mobile input no longer matches the desktop one.
Scale the text down. Keep font-size at 16px so Safari never zooms, then render at the intended size with a transform. Widen the element by the inverse of the scale so it still fills its container once shrunk. Divide line-height by the same factor so the intended leading survives. origin-left pins the text to the start edge, origin-right under RTL. Above the breakpoint, drop the transform and set the real size.
shrink-0 preserves the compensated width inside the flex wrapper. The wrapper clips the oversized layout box and draws an unscaled focus outline. Use the project's focus color and verify its contrast against the surrounding surface.
The transform shrinks the whole box, not only the glyphs, so let a wrapper draw the field's surface and keep the input transparent. A background, border or ring on the scaled element shrinks with the text and misses the intended hit area.
Decorative text
If -webkit-text-stroke draws lines inside the letters, the font has overlapping contours. Variable fonts often keep them unmerged, so use the static cut for stroked text.