Button
Loading fonts
Introduction
text-box: trim-both cap alphabetic makes padding the distance you see, from the box edge to the cap and the baseline. It has corner cases, and most of them are in interactive components. There the rule has to be turned off, and normalize-metrics makes turning it off safe.
style.css
Where trim is on
Buttons, text, cards, and textareas take the trim. The padding becomes the distance from the box edge to the cap and the baseline. The numbers are measured in your browser, in GT America.
Button
Loading fonts
Badge
Loading fonts
Tab
Loading fonts
Chip
Loading fonts
Button with icon
Loading fonts
Card
Loading fonts
Tile
Loading fonts
Paragraph
Loading fonts
Truncated text
Loading fonts
Clamped text
Loading fonts
Stat
Loading fonts
Tag
Loading fonts
Textarea
Loading fonts
When there is no capital
A label with no capital has nothing at the cap line, so trim on the cap leaves the letters below the token. The skill trims those labels to the x-height with text-box: trim-both ex alphabetic. CSS cannot see whether a string has a capital, so this goes on the component that is lowercase by design, not on every element.
Lowercase label
Loading fonts
Where trim is off
Text inputs of every type, selects, and date and time pickers draw their own text, and trim does not reach it. Chrome still clips an input to the trimmed line. Here the rule is off and the font’s own metrics come back: GT America sits low in the box. With the skill applied, the copy fixed by normalize-metrics centers the word.
Input
Loading fonts
Placeholder
Loading fonts
Search
Loading fonts
Number
Loading fonts
What an agent writes
The same tasks, given to an agent with and without the skill. The CSS is what it wrote, unedited.
Padding tokens
A new button, badge, card, and tile in Arial 16px. Padding 12, 4, and 24px; 16px under the card heading; 8px between the tile lines.
Tokens went straight into padding. The button measures 14.5px above the cap and 16px below the baseline.
style.css
An input that sits low
A new input in a brand font. The word sits low in the box; center it. Padding 12px.
Guessed ascent-override 75% and descent-override 25%, then said it may need a nudge after a visual check.
style.css
Button with an icon
A Save button with a 1em icon centered on the cap-height. Padding 12px.
inline-flex and align-items: center. The icon centers on the line box, not on the cap, and the padding counts the leading.
style.css
Install
For any agent that reads skills:
npx skills add gerguno/skill-text-box-trim
Or clone it into Claude Code:
git clone https://github.com/gerguno/skill-text-box-trim ~/.claude/skills/text-box-trim
Or into Cursor:
git clone https://github.com/gerguno/skill-text-box-trim ~/.cursor/skills/text-box-trim