html - 划线/删除线穿过整个 HTML 表格行

标签 html css html-table row strikethrough

经过一些研究,我找不到这个问题的答案。有 this但它并没有真正回答我的问题。我想在 CSS 中“删除”一个完整的 HTML 表格行,而不仅仅是其中的文本。有可能吗?从我链接的示例来看,似乎 tr 样式甚至在 Firefox 中都不起作用。 (无论如何,文字修饰只适用于文字 afaik)

最佳答案

哦,是的,是的!

CSS:

table {
    border-collapse: collapse;
}

td {
    position: relative;
    padding: 5px 10px;
}

tr.strikeout td:before {
    content: " ";
    position: absolute;
    top: 50%;
    left: 0;
    border-bottom: 1px solid #111;
    width: 100%;
}

HTML:

<table>
    <tr>
        <td>Stuff</td>
        <td>Stuff</td>
        <td>Stuff</td>
    </tr>
    <tr class="strikeout">
        <td>Stuff</td>
        <td>Stuff</td>
        <td>Stuff</td>
    </tr>
    <tr>
        <td>Stuff</td>
        <td>Stuff</td>
        <td>Stuff</td>
    </tr>
</table>

http://codepen.io/nericksx/pen/CKjbe

关于html - 划线/删除线穿过整个 HTML 表格行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4619542/

相关文章:

php - 在不使用 API 和库但使用标题类型的情况下将 Html + CSS 页面呈现为 PDF

php - 获取 img 的值

html - 将 tbody 设置为可滚动

jquery - 检索 ASP.NET 中动态创建的表的单元格值

html - 如果我们在 html 和 css 代码中应用一些属性,哪个将首先应用,哪个将最终应用

html - 使用 translateX(-50%) 将位置绝对元素居中不会使 div 居中

html - 如何为 anchor 标签的背景图片添加边框?

html - Flexbox 在 Safari 中不工作

html - 图像边框不显示 html 电子邮件

html - 如何在表格的 tbody/thead 部分周围创建边框?