How to Create Multi-Colored Text Strikethroughs with CSS?

Linda Hamilton
Release: 2024-11-16 12:32:03
Original
329 people have browsed it

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>
Copy after login

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!

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