How to Add Text Outline with CSS? Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report Since CSS does not provide a direct text-outline property, the CSS text-shadow property is used to create an outline effect around text by adding multiple shadows with offsets.1. Using text-shadow PropertyThe text-shadow property is commonly used to add shadows to text, by applying multiple shadows in different directions, an outline effect is created around the text.Syntaxtext-shadow: offset-x offset-y blur-radius color; HTML <h1 style="text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; color: white;"> This is an Outlined Text </h1> Outputusing text-shadow propertyAn outline can also be added around the text using the -webkit-text-stroke Property.2. Using -webkit-text-stroke Property The -webkit-text-stroke property directly applies a stroke around the text. It is simpler and more efficient than text-shadow but only works in WebKit-based browsers like Chrome and Safari.Syntax-webkit-text-stroke: width color; HTML <h1 style="color: white; -webkit-text-stroke: 2px black;"> This is an Outlined Text </h1> OutputUsing -webkit-text-stroke Property Comment More infoAdvertise with us Next Article How to set inner text shadow with CSS ? R rr346572 Follow Improve Article Tags : Web Technologies CSS Similar Reads How to set inner text shadow with CSS ? CSS is a style sheet language that describes the document's presentation written with HTML or similar markup languages. In this tutorial, we are going to learn how to set inner text shadows with CSS. Approach: Text shadow is used to design the text elements such as paragraphs, headings, etc. We firs 2 min read How to Set Border Opacity with CSS ? Border opacity in CSS controls the transparency of an elementâs border. While there's no direct property for border opacity, you can achieve it by using color functions like rgba() or hsla(), which allow you to specify the opacity of the border color.Syntaxborderborder: 1px solid rgba(255, 0, 0, 0.5 2 min read How to style outline buttons using CSS ? This article will explore how to style outline buttons using CSS. The Outline buttons give a clean visual appearance. The clear and visible border ensures the clear separation from the background and other elements and enhances readability. We can achieve the outline buttons effect in two different 3 min read How to Add Shadow to Text using CSS? The text-shadow property is used to add shadow to the text. The text-shadow property creates text shadows, specifying horizontal/vertical offsets, blur radius, and color for depth and emphasis.Note: We can customize text shadow by changing position, blur, and color for improved appearance and visual 1 min read How to Add a Gradient Overlay to Text with CSS? Adding a gradient overlay to text can create visually appealing effects that enhance the design of a website. CSS provides various techniques to apply gradients to text. Table of Content Approach 1: Using background-clipApproach 2: Using a MaskApproach 3: Using SVGGradient Overlay to Text using back 2 min read CSS outline-width Property The outline is the line that is created around the specified element outside the border of the element to make the particular distinct and easier to distinguish. The outline-width Property is used to specify the width of this outline for a specific element. The outline-style property must be declare 4 min read Like