Linethrough/strikethrough 整个 HTML 表格行 [英] Linethrough/strikethrough a whole HTML table row

查看:15
本文介绍了Linethrough/strikethrough 整个 HTML 表格行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

After some research, I couldn't find an answer to this question. There was this but it didn't really answer my question. I would like to "strikethrough" a complete HTML table row in CSS, not just the text in it. Is it at all possible? From the example that I linked, it seems tr styling doesn't even work in Firefox. (And anyway, text-decoration only applies on text 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

这篇关于Linethrough/strikethrough 整个 HTML 表格行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆