CSS strikethrough效果,Firefox问题

时间:2013-09-22 14:45:17

标签: html css firefox

我正在尝试使用此处描述的CSS删除线效果:https://stackoverflow.com/a/14593540/62072带有TD元素,但在Firefox中似乎有点不对。

enter image description here

火狐

enter image description here

CSS

.strikethrough
{
    position: relative;
}

    .strikethrough:before
    {
        position: absolute;
        content: "";
        /*width: 170%;*/
        /*left: -35%;*/
        left: 0;
        top: 50%;
        right: 0;
        border-top: 1px solid #333333;
        /*border-color: inherit;*/
        -webkit-transform: rotate(-35deg);
        -moz-transform: rotate(-35deg);
        -ms-transform: rotate(-35deg);
        -o-transform: rotate(-35deg);
        transform: rotate(-35deg);
    }

HTML

<span class="strikethrough">
    Test
</span>
<table>
    <tr>
        <td class="strikethrough">
            5
        </td>
    </tr>
</table>

这是一个JSFiddle来演示:http://jsfiddle.net/Ms4Qy/

知道为什么会这样吗?

1 个答案:

答案 0 :(得分:2)

已知FF在元素内部具有绝对元素,并显示table-cell

以下设置可能会起作用(但它可能会导致表格单元格出现其他一些问题):

.strikethrough
{
    display: inline-block;
}

jsFiddle Demo

相关问题