📜  css line-through color - CSS (1)

📅  最后修改于: 2023-12-03 15:14:18.489000             🧑  作者: Mango

CSS line-through color

CSS line-through color is a property that allows you to change the color of text that has been struck through using the "line-through" value of the "text-decoration" property.

Syntax

You can set the color of line-through text using the following CSS syntax:

text-decoration-line: line-through;
text-decoration-color: color;

For example, to set the color of line-through text to red:

text-decoration-line: line-through;
text-decoration-color: red;

Alternatively, you can use the shorthand "text-decoration" property to set both the line-through style and color at once:

text-decoration: line-through red;
Browser Support

CSS line-through color is supported in all modern browsers, including Chrome, Firefox, Safari, and Microsoft Edge.

Example

Here's an example of using CSS line-through color to strike through a text and set its color to red:

p {
  text-decoration: line-through red;
}

The result would look like this:

~~This text has a line-through and a red color.~~

Conclusion

CSS line-through color is a simple but useful property that can help you add more visual interest to your text. By changing the color of line-through text, you can create a more dynamic look and feel for your web pages.