stroke text
Hi guys, I want to create some text like the picture but when I use
text-stroke
the text is broken. Is there any way to fix it?
8 Replies
this seems to be a issue with the font nothing you can do about it i'm afraid
It looks bad because of the way the font is built. However, you can achieve an approximation of an outline with a series of text shadows: https://codepen.io/Beanie127/pen/GRbaKVN
Note you have to set an actual colour on the text rather than transparent, otherwise the shadow will be visible behind the text, and to scale it up to larger sizes, you'd need an increasing number of shadows to fill in each angle to make it look even slightly good (to see what I mean, scale up each 1px to 4px).
Thank you. I'll try
I know this is months old now but this popped up on Chrome.dev's CSS Wrapped article and tickled the memory of this question. Turns out the solution is
paint-order: stroke fill
https://developer.mozilla.org/en-US/docs/Web/CSS/paint-orderMDN Web Docs
paint-order - CSS: Cascading Style Sheets | MDN
The paint-order CSS property lets you control the order in which the fill and stroke (and painting markers) of text content and shapes are drawn.
great :thumbup:
It is possible to do with poorly designed fonts by using SVG text. https://codepen.io/chooking/pen/emOOQya
The LOREM in my example uses Montserrat, which is one of the fonts that exhibits the problem you encountered, but it works with this technique.