- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Set the color of the text decoration in CSS
To set the color of the text decoration, use the text-decoration-color property. To place this color overline, underline, line through, etc, use the text-decoration property. Let us see how to set the color of the text decoration
Color the text decoration overline
The text is decorated overline and then the color is set using the text-decoration-color property −
.demo { text-decoration: overline; text-decoration-color: yellow; }
Example
Here is the example −
<!DOCTYPE html> <html> <head> <style> .demo { text-decoration: overline; text-decoration-color: yellow; } </style> </head> <body> <h1>Examination Details</h1> <p class="demo">Exam on 20th December.</p> <p class="demo2">Exam begins at 9AM.</p> </body> </html>
Color the text decoration underline
The text is decorated underline and then the color is set using the text-decoration-color property −
.demo { text-decoration: underline; text-decoration-color: orange; }
Example
Let us now see another example −
<!DOCTYPE html> <html> <head> <style> .demo { text-decoration: underline; text-decoration-color: orange; } </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>
Color the text decoration line through
The text is decorated line-through and then the color is set using the text-decoration-color property. The line-through displays a line through the text
.demo { text-decoration: overline; text-decoration-color: blue; }
Example
Here is the example −
<!DOCTYPE html> <html> <head> <style> .demo { text-decoration: line-through; text-decoration-color: blue; } </style> </head> <body> <h1>Demo Heading</h1> <p class="demo">This is a demo text.</p> <p class="demo2">This is another demo text.</p> </body> </html>
Advertisements