8.2 · Typography & shape
Trim the extra space: text-box
Trim the invisible space around text so padding looks even.
Every line of text carries invisible space above the capital letters and below the baseline. That’s why a button with equal padding often looks bottom-heavy.
text-box: trim-both cap alphabetic trims the box to the
top of capital letters and the alphabetic baseline. Padding then
measures from the letters themselves, the way designers draw it.
.pill {
/* Nudged by eye, per font */
padding: 0.7rem 1.25rem 0.8rem;
}
.pill {
padding: 0.75rem 1.25rem;
text-box: trim-both cap alphabetic;
}