In CSS, the text-decoration property is used to add decorative styles to text, such as underlines, overlines, line-throughs, and more. The text-decoration property can take one or more values to apply different text decorations. Here are the possible values for the text-decoration property:
The text-decoration property is a shorthand property that allows you to set multiple text decoration values in one declaration. It includes the text-decoration-line, text-decoration-color, text-decoration-style, and text-decoration-thickness properties. It provides a convenient way to specify various aspects of text decoration in a single line of code.
Here's an example of using the text-decoration property:
a {
text-decoration: underline;
}
p {
text-decoration: line-through;
}
In this example, the text-decoration property is used to add an underline to all anchor (<a>) elements and a line-through to all paragraph (<p>) elements.
Additionally, you can combine multiple text decorations if needed. For example:
h1 {
text-decoration: underline overline;
}
In this case, the h1 element will have both an underline and an overline applied to the text.
The text-decoration property can also be used to specify the color, style, and thickness of the decorative lines. For example, to add a red, dashed underline to text, you would use the following code:
h1 {
text-decoration: underline dashed red;
}
h1 {
text-decoration-line: underline;
text-decoration-color: blue;
text-decoration-style: dashed;
text-decoration-thickness: 2px;
}
p {
text-decoration-line: line-through;
text-decoration-color: red;
text-decoration-style: double;
text-decoration-thickness: 3px;
}
a {
text-decoration-line: overline;
text-decoration-color: green;
text-decoration-style: dotted;
text-decoration-thickness: 1px;
}