Home > Web Front-end > CSS Tutorial > Can I Change the Strikethrough Line Color in CSS?

Can I Change the Strikethrough Line Color in CSS?

Mary-Kate Olsen
Release: 2024-11-14 12:34:02
Original
497 people have browsed it

Can I Change the Strikethrough Line Color in CSS?

Styling the Strikethrough Color in CSS

The strikethrough effect can be achieved using HTML elements like , , or or by applying the CSS text-decoration property with a value of line-through. However, the strikethrough line typically matches the text color.

Can CSS Be Used to Alter the Line Color?

Yes, CSS allows you to change the line color by nesting elements and assigning different colors to them. For instance:

<span>
Copy after login

In this example:

  • The outer <span> element sets the line color to red through the text-decoration property.
  • The inner <span> element sets the text color to black.
  • By nesting the elements, the strikethrough line takes on the red color defined in the outer <span>, while the text within the inner <span> remains black.

    The above is the detailed content of Can I Change the Strikethrough Line 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