【发布时间】:2017-01-15 19:43:05
【问题描述】:
我有一个带有删除线的链接。我想让删除线更轻,以便链接文本更易于阅读,但不知道该怎么做。
这是我想要的样子(使用内部跨度而不是链接,因为它以我想要的方式出现):
span.outer {
color: red;
text-decoration: line-through;
}
span.inner {
color: green;
}
<span class="outer">
<span class="inner">foo bar</span>
</span>
但这似乎不起作用:
span.outer {
color: red;
text-decoration: line-through;
}
a.inner {
color: green;
}
<span class="outer">
<a href="#" class="inner">foo bar</a>
</span>
有什么想法吗?
【问题讨论】:
-
我会使用一个移位的边框来使其穿透您的文本。我认为您无法更改删除线颜色。
-
据我所知你不能。你可以做一些黑客攻击......例如K48建议的那个。或者使用伪元素!
-
我同意@Gacci。伪元素似乎是一个不错的方法。它们易于创建和管理。
标签: css strikethrough line-through