Computer >> Computer tutorials >  >> Programming >> CSS

Set the style of the text decoration in CSS


To set the style of the text decoration, use the text-decoration-style property. You can use the following values −

text-decoration-style: solid|double|dotted|dashed|wavy|initial|inherit;

Example

<!DOCTYPE html>
<html>
<head>
<style>
span {
   text-decoration: line-through;
   text-decoration-color: blue;
}
.demo2 {
   text-decoration: underline;
   text-decoration-style: double;
   text-decoration-color: red;
}
</style>
</head>
<body>
<h1>Details</h1>
<p class="demo">Examination Center near <span>XYZ College</span> ABC College.</p>
<p class="demo2">Exam begins at 11AM.</p>
</body>
</html>

Output

Set the style of the text decoration in CSS

Example

Let us now see another example −

<!DOCTYPE html>
<html>
<head>
<style>
.demo {
   text-decoration: overline;
   text-decoration-color: blue;
   text-decoration-style: wavy;
}
.demo2 {
   text-decoration: overline;
   text-decoration-style: dashed;
   text-decoration-color: red;
}
</style>
</head>
<body>
<h1>Details</h1>
<p class="demo">Examination Center near ABC College.</p>
<p class="demo2">Exam begins at 11AM.</p>
</body>
</html>

Output

Set the style of the text decoration in CSS