Making line-through color to appear different than the text (using CSS)

I am posting a simple trick to make the color of line-through line to appear different than the stricken text. I had to recall this trick actually as we rarely use it and i guess i myself never used it before i guess (may be i had but i don’t know exactly. :) ).

Ok. As of normal, to strike text we can write:

<span style="text-decoration:line-through;">Strike through this text</span>

gives Strike through this text

or

<strike>Strike through this text</strike>

gives Strike through this text.

The color of text and line-through above was black, which is the default color of my page so didn’t really need to write it. To apply a red line-through color I’ll do:

<span style="text-decoration:line-through;color:red;">
<span style='color:black;'>Strike through this text</span>
</span>

gives Strike through this text

or

<strike style='color:red;'>
<span style='color:black;'>Strike through this text</span>
</strike>

gives Strike through this text

Share

Possibly Related posts:

Tags : , , ,

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

One Comment

Leave Comment

Freelance Jobs