Text Decoration in CSS

CSSWeb DevelopmentFront End Technology

For text decoration in CSS, use the text-decoration property as a shorthand property for the following properties −

text-decoration-line
text-decoration-color
text-decoration-style

Example

Let us see an example for text decoration in CSS −

 Live Demo

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

Output

Example

Let us now see another example wherein we are using separate values −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
p {
   writing-mode: vertical-rl;
   text-decoration-line: overline;
   text-decoration-color: red;
   text-decoration-style: wavy;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<p>This is demo text.</p>
</body>
</html>

Output

raja
Updated on 30-Dec-2019 10:54:26

Advertisements