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

Can You Customize Strikethrough Color in CSS?

DDD
Release: 2024-11-23 00:14:20
Original
788 people have browsed it

Can You Customize Strikethrough Color in CSS?

Customizing Strikethrough Color in CSS

The , , and HTML tags provide various options for creating text strikethrough effects. Similarly, the CSS text-decoration property with a line-through value can achieve the same effect. However, in most cases, the strikethrough line color matches the text color.

Can CSS be used to differentiate the strikethrough line color from the text color?

Yes, it's possible to create a strikethrough line with a different color using CSS by incorporating an extra wrapping element:

<span>
Copy after login

In this example, an outer <span> element is given a red color and line-through decoration. Within this outer element, an inner <span> element contains the text with a contrasting black color. This approach allows for a distinct strikethrough line color while still maintaining the text color.

The above is the detailed content of Can You Customize 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template