Outlined Text

Large display heading with transparent fill and a crisp text stroke outline.

OUTLINED

Tailwind CSS
<h2 class="text-5xl sm:text-6xl font-extrabold tracking-tight text-transparent [-webkit-text-stroke:2px_#0f172a] dark:[-webkit-text-stroke:2px_#e2e8f0]">OUTLINED</h2>

Free to use in personal and commercial projects. No attribution required.

Variants

Same component, different looks. Preview each one live and copy the code you like.

Indigo stroke

An indigo stroke ties the headline into branded hero sections.

DESIGN

Tailwind CSS

Thick stroke

The thicker stroke reads better at a distance on posters and billboards.

IMPACT

Tailwind CSS

Small

The small size works for eyebrows and kickers above the main headline.

outline

Tailwind CSS

About this outlined text

Outlined display type, transparent letterforms traced with a stroke, is a staple of hero sections, posters, and sportswear branding. It adds drama at large sizes while staying light, and it pairs beautifully with solid type in the same headline.

The snippet sets text-transparent so the fill disappears, then applies the stroke through an arbitrary property: [-webkit-text-stroke:2px_#0f172a]. The underscore becomes a space, and Tailwind passes the declaration through exactly as written.

Use it for short display words at big sizes, ideally 3xl and up. Thin strokes vanish at small sizes, and full sentences in outline type are hard to read. For maximum impact, mix one outlined word with solid words in the same headline.

Solid display type shouts; outlined type draws. Transparent letterforms traced with a stroke bring a poster and sportswear energy to hero sections, big and dramatic while staying light enough to pair with solid type in the same headline. It is how you make a headline feel designed rather than typed.

The snippet sets text-transparent so the fill disappears, then applies the stroke through an arbitrary property: [-webkit-text-stroke:2px_#0f172a]. The underscore becomes a space and Tailwind passes the declaration through exactly as written. There is no Tailwind-native text-stroke utility, which is why the arbitrary property escape hatch exists.

Scale the stroke with the font size: 1px at 16px text, 2px at display sizes, 3px only for massive hero type. A 2px stroke on small text fills the counters and turns letters into blobs. Test the outline on your actual background photos, not just solid colors; busy images swallow thin strokes. For the fallback, set a solid text color first so browsers without text-stroke support show readable text instead of invisible transparent letters.

Outlined text over a busy photo is where the effect dies: the stroke competes with the background detail and the letters dissolve into the noise. The backdrop matters as much as the stroke, so put a subtle dark overlay or a clean panel behind outlined display type, or restrict it to quiet gradient backgrounds. Drama needs a quiet stage.

Where to use it

  • ✓ Hero section display headlines
  • ✓ Poster and event graphics
  • ✓ Oversized section dividers
  • ✓ Brand wordmarks in headers

Customization tips

Thicken the stroke to 3px for a bolder poster look, or swap the hex for your brand color. Add a hover variant like hover:[-webkit-text-stroke:2px_#4f46e5] to recolor the stroke interactively.

Design notes

When to use

Outlined display type is made for large hero headlines, poster sections, and sporty branding where you want drama without visual weight. The transparent fill keeps big words feeling light, and it pairs beautifully with a solid-filled word in the same line for contrast. Keep it at display sizes where the stroke reads as a design choice, not a rendering glitch.

What to avoid

Do not use outlined text at small sizes or for body copy, because the stroke eats the letterforms and the words become unreadable mush. Avoid thin dark strokes on dark backgrounds, where the text simply vanishes. It is a headline trick, not a paragraph style, so do not ask it to carry real reading.

Accessibility

Transparent fill with a 2px stroke usually fails contrast requirements, so check the stroke color against the background and aim for at least 3 to 1 for large text. Provide a solid-text fallback for high-contrast mode users who may not see the stroke effect at all.

Frequently asked questions

Does -webkit-text-stroke work in Firefox?

Yes. Despite the webkit prefix, Firefox has supported -webkit-text-stroke for years. Every modern browser renders it correctly.

Why does the text look thin or broken at small sizes?

The stroke is drawn centered on the glyph edge, so at small sizes it eats into the letterforms. Keep outlined type large, or drop to a 1px stroke for smaller text.

Can I animate the stroke color?

Yes, the stroke color transitions like any CSS property. Add transition-colors and change the arbitrary property on hover for a smooth recolor effect.

How do I make hollow outlined text with no fill?

Set color to transparent and add -webkit-text-stroke with your width and color, for example 2px solid white. The glyph interiors go invisible and only the outline renders. This is the classic hero heading look, and it works best at large sizes where the stroke stays crisp.

What is the difference between text-stroke and text-shadow outlines?

text-stroke draws a true vector outline around each glyph, so curves stay smooth at any size. text-shadow fakes the outline by stacking offset shadows, which looks fine at 1px but gets blurry and lumpy when thicker. Use text-stroke for the real effect and keep text-shadow only as a fallback for ancient browsers.

How do I add a fallback for browsers without text-stroke?

Wrap the -webkit-text-stroke rule in @supports (-webkit-text-stroke: 1px black) and put a four-direction text-shadow outline outside it as the fallback. Every modern browser passes the supports check, including Firefox, so the fallback only ever serves truly old engines.