CSS text-decoration is used to define the decoration of text. This property is a shorthand property by which we can define all the decorations of text in just a single setting. These decorations are CSS decoration color, CSS decoration line, and CSS decoration style.
Syntax
1 |
text-decoration: enter value for decoration |
Example
let’s take the example of a paragraph contains some text to underline. CSS text decoration will make this content underlined as you can find in the example given below.
Test it Live
1 2 3 4 5 6 |
<style> p.txt-underline{ text-decoration:underline; } </style> <p class="txt-underline">This is an underlined text.</p> |
Output
This is an underlined text.
CSS text decoration values list
The values and description of this property is used for defining decoration of text.
Sr. No. | value | Description |
---|---|---|
1 | none | Used to define the no decoration of the text. The value for this is none. |
2 | underline | Used to make the text underline. The value for this is underline. |
3 | overline | Used to make the text appear line over it. The value for this is overline. |
4 | line-through | Used to make the text to appear like deleted text. The value for this is line-through. |
5 | initial | Used to define as the property initial value. |
6 | inherit | Used to define the computed value of property on the elements parent. |
7 | unset | Used to define the property either acts as inherit or initial, depending on the property if it is inherited or not. |
You may also like to read