如何删除CSS换行符 [英] How to Remove CSS line-through
问题描述
我试图删除 text-decoration:line-through;
样式应用于我的元素,我似乎不能这样做。我尝试过 text-decoration:none;
但它不工作。
I am trying to remove the text-decoration:line-through;
style applied to my element and I cannot seem to be able to do so. I have tried text-decoration:none;
but it does not work.
c> text-decoration:underline; 到 span
,似乎不是替换 line-through
style浏览器添加下划线
样式。
When I apply text-decoration:underline;
to span
, it seems that instead of replacing the line-through
style the browser adds the underline
style.
我知道我可以随时重写我的HTML所以需要 line-through
的元素有自己的类。我想知道是否有其他选择,然后重组我的HTML。
I know I can always re-write my HTML so the elements that require a line-through
has their own class. I'm wondering if there is an alternative other then restructuring my HTML.
<style>
p { text-decoration:line-through; }
span { text-decoration:none; }
</style>
<p>Foo <span>bar</span></p>
推荐答案
总是重写我的HTML,所以需要
line-through
的元素有自己的类。我想知道是否有其他选择,然后重组我的HTML。
I know I can always re-write my HTML so the elements that require a
line-through
has their own class. I'm wondering if there is an alternative other then restructuring my HTML.
不是真的。您看到的行为完全按设计;祖先将总是将他们的文本装饰传播到某些后代,而相反,你不能影响来自后代的祖先的文本装饰。
Not really. The behavior you see is totally by design; ancestors will always propagate their text decorations to certain descendants, and conversely you can't affect an ancestor's text decoration from within a descendant.
没有一个非常可行的替代重组,但目前虽然 text-decoration-skip
从即将到来的CSS3文本修饰模块看起来很有前途。
There isn't a very viable alternative to restructuring, currently, although text-decoration-skip
from the upcoming CSS3 text decoration module looks promising.
这篇关于如何删除CSS换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!