Home > Web Front-end > CSS Tutorial > Can You Change Strikethrough Color in CSS?

Can You Change Strikethrough Color in CSS?

Patricia Arquette
Release: 2024-11-17 02:22:03
Original
582 people have browsed it

Can You Change Strikethrough Color in CSS?

CSS Strikethrough in a Distinct Color

The HTML elements del, strike, and s, as well as the CSS text-decoration property with a value of line-through, allow for text strikethrough effects. However, the strikethrough line typically matches the text color.

Can the Strikethrough Color Be Modified?

Yes, it is possible to change the strikethrough color using CSS by adding an extra wrapping element. Assign the desired line-through color to the outer element and the desired text color to the inner element. For instance:

<span>
Copy after login

This code will display text with a black color and a red strikethrough line.

The above is the detailed content of Can You Change Strikethrough Color in CSS?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template