Home / Companies / LogRocket / Blog / Post Details
Content Deep Dive

Can you create beautiful stroked text in CSS?

Blog post from LogRocket

Post Details
Company
Date Published
Author
Rob O'Leary
Word Count
3,422
Language
-
Hacker News Points
-
Summary

Stroked text, also known as outlined text, is a technique used in graphic and web design to enhance readability and aesthetic appeal by creating a border around letters. This approach can be implemented in web pages using CSS or SVGs, each having its advantages and limitations. The CSS method involves using properties like the non-standard `-webkit-text-stroke` or hacks involving text shadows and pseudo-elements, but these can be inconsistent across different browsers and operating systems. SVGs, on the other hand, offer more reliable control over stroke attributes, such as color and width, ensuring consistent appearance across browsers. While variable fonts could theoretically provide stroke effects, this feature is not commonly available. Due to the limitations and lack of a standardized CSS stroke property, using SVGs is often recommended for creating stroked text, ensuring accessibility and consistency. Despite the challenges, stroked text remains popular for its ability to make text stand out, particularly in design contexts like fashion, media, and entertainment.