Method: First embed the span tag containing text in the parent tag p; then add a strikethrough style in the parent tag p, and use the color attribute to set the color of the text and strikethrough; finally use in the span tag The color attribute can reset the text color.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
In css, you can add the strikethrough effect of text with the text-decoration attribute
Rendering:
So how to set the color of the strikethrough? Let’s take a look at the sample code:
Rendering:
In this way we combinetext-decoration: line-through;
and The style defines the style of the text font color, and you can achieve the style effect of different colors of strikethrough and text in CSS. Isn’t it very simple!
(Learning video sharing:css video tutorial)
The above is the detailed content of How to set color for strikethrough in css. For more information, please follow other related articles on the PHP Chinese website!