How to Outline Text in CSS

Use the text-shadow CSS property instead of the -webkite-text-stroke CSS property. Open Source code included.

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 03/17/2024 at 11:53
Last Updated on 03/17/2024 at 16:05
<p>Two flowers that represent ReactJS and CSS side by side, beneath them sits the text "Text Stroke."</p>

Use the text-shadow CSS property instead of the -webkite-text-stroke CSS property. Open Source code included.

SubscribeDownload Open Source Starter Project

We recommend that you clone our Open Source React-Redux Starter Project, checking out the main branch and apply the code found below to the App.tsx file. The changes can be found on the tutorial/typography/outline branch.

git clone git@github.com:delasign/react-redux-starter-project.git
View Repository
<p>If you use -webkite-text-stroke it will not work adequately.</p>

The -webkit-text-stroke property does not work as expected.

This tutorial offers a solution for creating outlined text by using the text-shadow CSS property instead of the -webkit-text-stroke CSS property.

<p>The text-shadow property produces the expected outline.</p>

The text-shadow property works as expected.

This solution was provided by Ryall on StackOverflow and can be found below.

Please note that you need to fill the text with the fill color otherwise it will not appear as expected.

Looking to learn more about ReactJS and CSS ?

Search our blog to find educational content on learning how to use ReactJS and CSS.

Search our Blog

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
SubscribeContact UsVisit our BlogView our ServicesView our Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe