简体   繁体   English

CSS删除线效果,Firefox问题

[英]CSS strikethrough effect, Firefox issue

I'm trying to use the CSS strikethrough effect described here: https://stackoverflow.com/a/14593540/62072 with a TD element, but it seems to go a bit wrong in Firefox.. 我正在尝试使用此处描述的CSS删除线效果: https : //stackoverflow.com/a/14593540/62072和TD元素,但在Firefox中似乎有点错误。

Chrome

在此处输入图片说明

Firefox 火狐浏览器

在此处输入图片说明

CSS 的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 的HTML

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

Here is a JSFiddle to demonstrate: http://jsfiddle.net/Ms4Qy/ 这是一个JSFiddle来演示: http : //jsfiddle.net/Ms4Qy/

Any idea why this might be? 知道为什么会这样吗?

FF is known to have some strange behaviors with absolute elements inside element with display of table-cell . 已知FF在table-cell显示元素内部具有绝对元素时会发生一些奇怪的行为。

The following setting might do the work (but it might cause some other problems with the table cells): 以下设置可能会起作用(但是可能会导致表单元格出现其他一些问题):

.strikethrough
{
    display: inline-block;
}

jsFiddle Demo jsFiddle演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM