paint-order
Text fill is painted first, then the stroke, on top. A stroke is centered on the outline of the letter, so half of it covers the fill: a 6px stroke is 3px into the text and 3px outside. Using paint-order: stroke paints the stroke first and the fill over it. The fill covers the inner 3px, so the letter keeps its full shape and what you see is a 3px outline. The stroke itself comes from -webkit-text-stroke. (The prefix is part of the property’s name in every browser. No unprefixed form exists.) SVG has had the property for years, and Chrome 123 was the last browser to extend it to HTML text, in March 2024, 30 months before this September.
Delete: the second copy of the text that draws the stroke behind the real one, usually a pseudo-element.
/* the text twice, with the stroke on the copy behind */
.title { position: relative; z-index: 0; }
.title::before {
content: attr(data-text);
position: absolute; inset: 0; z-index: -1;
-webkit-text-stroke: 6px white;
}
.title { -webkit-text-stroke: 6px white; paint-order: stroke; }Failure is graceful: a browser without the property paints the stroke on top, and the outline looks thinner. Firefox’s summary score on this feature is low, but none of what it fails is relevant to stroked HTML text. The stroke sits behind the fill in Firefox too.