I have a link that has a strikethrough. I want to make the strikethrough lighter so the link text is easier to read, but can't figure out how to do it.
Here's what I want it to look like (using an inner span instead of a link because it comes out the way I want):
span.outer {
color: red;
text-decoration: line-through;
}
span.inner {
color: green;
}
<span class="outer">
<span class="inner">foo bar</span>
</span>
But this doesn't seem to work:
span.outer {
color: red;
text-decoration: line-through;
}
a.inner {
color: green;
}
<span class="outer">
<a href="#" class="inner">foo bar</a>
</span>
Any ideas?
Interesting that your first example works, I wouldn't have expected that… good to know, I guess!
You can achieve this appearance with a pseudo-element. Make sure the element is
position:relativeand then position the pseudo-elementabsolute, full-width, however tall you want the line to be, andtop:[50% - half the height, rounded]. It'll look like this:You can even have the line extend a little on the sides by giving the element some horizontal padding.