我有一些代码在TR上为删除的行添加了一行代码,但这意味着我的"Actions"列(只有)按钮会受到影响.这是因为按钮之间有个别空间,最终也会排成一行.
在W3Schools上闲逛之后,我很难理解为什么这个例子不起作用:
<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>
Run Code Online (Sandbox Code Playgroud)
我该如何清除子元素的直通线?
编辑 我已经更新了我的例子 - 问题是我不想从父元素中取出样式,只是一个子元素.
您不必为此使用重要或内联样式。尝试
h2 {text-decoration:line-through;}
h2 span {text-decoration: none; border: 1px solid black;}
Run Code Online (Sandbox Code Playgroud)
编辑
在这种情况下,由于您对 tr 应用了文本装饰,因此您必须从同一元素 tr 而不是 td 中去除文本装饰。否则执行:
tr td { text-decoration: whatever }
Run Code Online (Sandbox Code Playgroud)
然后在需要的时候
<td style="text-decoration: none;"></td>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9334 次 |
| 最近记录: |