在我的场景中,我有一些带有已删除部分的文本部分,由line-through
. 有时,这些部分是嵌套的。我想产生这样的输出(请运行代码段):
span.strike1 {
text-decoration:line-through;
text-decoration-style:solid;
}
span.strike2 {
text-decoration:line-through;
text-decoration-style:double;
}
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing
elit. <span class="strike1">Aenean commodo ligula
eget dolor. </span><span class="strike2">Aenean massa.
Cum sociis natoque penatibus et magnis dis parturient
montes, nascetur ridiculus mus. Donec quam felis,
ultricies nec, pellentesque eu, pretium quis,
sem.</span><span class="strike1"> Nulla consequat
massa quis enim.</span> Donec pede justo, fringilla
vel, aliquet nec, vulputate eget, arcu.</p>
但是,我想用嵌套元素重现相同的结果。如果不应用 javascript,这实际上可以实现吗?嵌套text-decoration-style:double
到text-decoration-style:solid
将产生一条三线(双线+实线),请参见此处:
span.strike {
text-decoration:line-through;
text-decoration-style:solid;
}
span.strike span.strike {
text-decoration:line-through;
text-decoration-style:double;
}
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing
elit. <span class="strike">Aenean commodo ligula eget
dolor. <span class="strike">Aenean massa. Cum sociis
natoque penatibus et magnis dis parturient montes,
nascetur ridiculus mus. Donec quam felis, ultricies
nec, pellentesque eu, pretium quis, sem.</span> Nulla
consequat massa quis enim.</span> Donec pede justo,
fringilla vel, aliquet nec, vulputate eget, arcu.</p>
此外,似乎不可能影响 的位置text-decoration
。我也尝试过使用border
and的解决方法:after
,但这不适用于多行。我很感激任何帮助。