Home >Web Front-end >CSS Tutorial >How to Create Multi-Colored Text Strikethroughs with CSS?

How to Create Multi-Colored Text Strikethroughs with CSS?

Linda Hamilton
Linda HamiltonOriginal
2024-11-16 12:32:03383browse

How to Create Multi-Colored Text Strikethroughs with CSS?

Achieving Multi-Colored Text Strikethroughs with CSS

The HTML elements del, strike, or s and the CSS property text-decoration:line-through can all be used to create strikethrough effects. However, by default, the strikethrough line is the same color as the text.

How to Change the Strikethrough Color

To customize the strikethrough color, an additional wrapping element can be utilized. By assigning the desired line-through color to the outer element and the desired text color to the inner element, a multi-colored strikethrough can be achieved.

For instance, consider the following code snippet:

<span>

In this example, the outer span has a red line-through while the inner span has black text. This results in the text "black with red strikethrough" appearing with a black color and a red strikethrough line.

The above is the detailed content of How to Create Multi-Colored Text Strikethroughs with CSS?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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