Text Stroke

The Text Stroke system allows you to add outlined text with customizable stroke width and color. This is useful for creating text that stands out against shaded backgrounds.

Note: Text Stroke works only on pure black or white text.

Learn More

Basic Usage

Apply text-stroke to outline text. Combine with width and shade modifiers as needed.

<span class="text-stroke">Outlined text</span>

Widths

The Text Stroke system includes preset size modifiers that allow you to quickly apply different stroke widths to your text. The default stroke is 3.5px white, with additional options for small (2px), medium (4.5px), large (6px), and extra large (7.5px).

Aa No Stroke
Aa Small
Aa Default
Aa Medium
Aa Large
Aa Extra Large
Text Stroke Preset Sizes
<span class="value value--large">Aa</span>
<span class="value value--large text-stroke text-stroke--small">Aa</span>
<span class="value value--large text-stroke">Aa</span>
<span class="value value--large text-stroke text-stroke--medium">Aa</span>
<span class="value value--large text-stroke text-stroke--large">Aa</span>
<span class="value value--large text-stroke text-stroke--xlarge">Aa</span>
Aa No Stroke
Aa Small
Aa Default
Aa Medium
Aa Large
Aa Extra Large
Text Stroke Shades
<span class="value value--large text--white">Aa</span>
<span class="value value--large text--white text-stroke text-stroke--small text-stroke--black">Aa</span>
<span class="value value--large text--white text-stroke text-stroke--black">Aa</span>
<span class="value value--large text--white text-stroke text-stroke--medium text-stroke--black">Aa</span>
<span class="value value--large text--white text-stroke text-stroke--large text-stroke--black">Aa</span>
<span class="value value--large text--white text-stroke text-stroke--xlarge text-stroke--black">Aa</span>

Browser Limitations

Text Stroke works only when the text itself is pure black or pure white. This is due to how browsers render strokes relative to text fills.

We simulate grayscale text by applying hand-crafted bitmap patterns as a background and revealing them with background-clip: text (with transparent text color). This makes text appear gray, but under the hood the fill is not a solid color - it's a background image clipped to the text.

The CSS paint-order property cannot treat a background as a pass-through fill layer, so only paint-order: stroke fill; is effective when the fill is a solid color. Because clipped backgrounds are not considered a fill for paint-order, we cannot stroke around grayscale (background-clipped) text. Use black or white text when you need a stroke.