Trusted answers to developer questions

How to create a text outline using CSS

Free System Design Interview Course

Many candidates are rejected or down-leveled due to poor performance in their System Design Interview. Stand out in System Design Interviews and get hired in 2024 with this popular free course.

Fonts on the web are essentially vector graphics; this​ means that they can be resized and manipulated just like vector images. CSS has a text-stroke property that can be used to create outlines around a text on Webkit-enabled browsers.

Consider the below examples which make use of text-stroke to create outlines around the text:

svg viewer

The text-shadow property can also be used to produce an effect similar to a text outline. A text can have four possible text shadows (top-right, bottom-right, bottom-left, and top-left), each with four values (horizontal shadow, vertical shadow, blur radius, and shadow color).

The examples below use text-shadow in conjunction with text-stroke:

RELATED TAGS

css
text
outline
styling
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?