问题描述
我有一些代码在TR上删除了行,但这意味着我的Actions列(只有)会受到影响。这是因为按钮之间存在单独的空间,这也导致了线条通过。
I've got some code that puts a line-through on a TR for deleted rows, but this means that my "Actions" column (that only has) buttons suffers. This is because there are individual spaces between the buttons, which wind up getting line-throughed as well.
在W3Schools上探索之后,它让我惊讶,为什么这个例子没有t工作:
After poking around on W3Schools, it boggles me why this example doesn't work:
<html>
<head>
<style type="text/css">
tr {text-decoration:line-through}
</style>
</head>
<body>
<table>
<tr>
<td>this needs to be line-throughed</td>
<td style="text-decoration: none !important;">This shouldn't be line-throughed.</td>
</tr>
</table>
</body>
</html>
我应该如何清除子元素上的直通线?
How am I supposed to clear the line-through on child elements?
编辑
我更新了我的示例 - 问题是我不想从父元素中取出样式,只是单个子元素。
EDITI've updated my example - the problem is that I do not want to take the style off the parent element, just a single child element.
推荐答案
您不必为此使用重要或内联样式。尝试
You shouldn't have to use important or inline styles for this. Try
h2 {text-decoration:line-through;}
h2 span {text-decoration: none; border: 1px solid black;}
编辑
在这种情况下,如果你使用了tr,那么你必须对文本进行修饰,而不是使用文本修饰。否则:
In that case with tr since yeah you applied text-decoration to it, you have to take text-decoration off the same element tr not td. Otherwise do:
tr td { text-decoration: whatever }
然后在需要时
and then when needed
<td style="text-decoration: none;"></td>
这篇关于CSS Line-Through未被删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!