Tony the Pony Tony the Pony - 1 year ago 132
HTML Question

CSS: Line-through with a color different from the text color?

I’d like to have gray text with a red strike-through, but this style doesn’t work:

color: #a0a0a0;
text-decoration: line-through 3px red;

What am I doing wrong?

Answer Source

You can simulate the desired effect with two nested elements, e.g.:

<style type="text/css">
    span.inner {
        color: green;
    span.outer {
        color: red;
        text-decoration: line-through;

<span class="outer">
    <span class="inner">foo bar</span>


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download