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

Can You Customize Strikethrough Color in CSS?

DDD
DDDOriginal
2024-11-23 00:14:20804browse

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>

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!

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