Set the style of the text decoration in CSS

CSSWeb DevelopmentFront End Technology

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

 Live Demo

<!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

Example

Let us now see another example −

 Live Demo

<!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

raja
Published on 26-Dec-2019 10:51:03
Advertisements