How to Add Border Around Text using CSS? Last Updated : 19 Nov, 2024 Comments Improve Suggest changes Like Article Like Report The CSS border property is used to add a border around text by wrapping the text in an HTML element like <span> or <p>. Syntaxborder: "borderWidth borderStyle colorName;"Example 1: Adding a border around the text content using CSS. HTML <p> The following text has a border <span style="border: 2px solid green; padding: 10px;"> Text with border </span> </p> Outputtext with borderExample 2: Adding a border around the text content using CSS. HTML <p style="border: 1px solid green; padding: 10px; display: inline-block;"> Text with border </p> Outputtext with border Comment More infoAdvertise with us Next Article How to Add Border Around Text using CSS? V vkash8574 Follow Improve Article Tags : Web Technologies CSS Geeks Premier League CSS-Questions Geeks Premier League 2023 +1 More Similar Reads How to Add an Iframe Border using CSS ? This article will show you how to add a border to the iframe element using CSS. An inline frame is used to embed another document within the current HTML document. To add the iframe border, we will use the CSS border property. Syntax:<!-- CSS border to the iframe --><style> iframe { bord 1 min read How to Add Border to an Image Using HTML and CSS? Adding a border to an image means putting a line around the image to make it look better and more noticeable. To add a border to an image using HTML and CSS, we can use the <img> tag and apply CSS styles like border, border-width, and border color to customize the border's appearance.Syntax.im 1 min read How to use Text as Background using CSS? Using text as a background in CSS means creating a visual effect where large text is placed behind content, often appearing as a decorative or watermark-like element. This effect can be achieved by positioning, opacity adjustments, and layering techniques with CSS.Here we have some common methods to 3 min read How to create and style border using CSS ? The border property is used to create a border around an element and defines how it should look. There are three properties of the border. border-colorborder-widthborder-style border-style property: This defines how the border should look like. It can be solid, dashed, offset, etc. The following val 4 min read How to Create a Cutout Text using HTML and CSS ? Cutout text is used as a background header of the webpage. The cutout text creates an attractive look on the webpage. To create a cutout text we will use only HTML and CSS. We display the cutout text and then we make the text blending of an elementâs background with the elementâs parent. The CSS mix 2 min read Like