• Post category:CSS

 How to Create CSS Text-Stroke | CSS Tricks

 CSS Text-Stroke Outside

What is text stroke?

It is also called a text border. CSS text-stroke outside is the border outside the text. You can use the WebKit-text-stroke CSS property to create text-stroke for all HTML elements.

How to create CSS text-stroke

<style type="text/css">
color: transparent;
-webkit-text-stroke: 2px darkred;

<h1>TEXT STROKE</h1>


 css text-stroke outside

See the above output, only text stroke is displayed because we can give the text color transparent. So, the text color is not displayed.

Step-by-step explanation :

  1. You create an HTML element and put some text in it like in the above code.
  2. In CSS, first, you should select that element using an element or class selector.
  3. If you want to display only the text stroke, You should use the CSS “color” property and give the value as “transparent”. Or If you want to display the color of the text, You can give your desired color name to the color property.
  4. To create text-stroke of an HTML text, you can use the CSS “-webkit-text-stroke” property as in the above code and give the size of the stroke for ex.2px in the above code and give stoke color.

Leave a Reply