Monday, June 11

How to give a different color to line-strike and a different color to text in html css.

Encountered this problem when I had to give text color red and the strike through line color black.

The html markup should have strike tag outside with your style and then your text inside a span with its style. This way we can achieve a strikethrough with different color than its containing text. Following is the html code. For simplicity sake I'll be using inline styles.

<strike style="color:#000000;">
                <span style="#FF0000">MY Text</span>

Yup, this is already solved here on stackoverflow. You can find alternative answer as well.

Be the first one to Comment!!!

Post a Comment