我有一个带有过渡的html / css代码。过渡在Chrome中工作正常,但在IE 11中失败。有人可以指出问题吗?

此代码在chrome上正常工作并显示过渡。但是在IE 11上,过渡失败。我尝试删除calc函数,但在IE 11上仍然无法正常工作。这是代码

    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="x-ua-compatible" content="IE=9;IE=10;IE=Edge,chrome=1"/>
    <style>
    .notch{position: absolute;

        left: calc(95vw - 37.5px);
        top: calc(50% - 5px);
        width: 75px;
        height: 110px;
        box-sizing: border-box;
        font-size: 30px;
        text-align: center;
        line-height: 110px;
        transition: all 60s linear;
        }
    </style>
    </head>
    <body>
    <div class="notch">NOTCH</div>
    </body>
    </html>
simonfeng88 回答:我有一个带有过渡的html / css代码。过渡在Chrome中工作正常,但在IE 11中失败。有人可以指出问题吗?

过渡CSS属性支持IE 10 +,在IE浏览器中使用它时,我们需要添加供应商前缀-ms-,例如:-ms-transition: all 5s linear;

此外,关于transition documentCSS transition Property,我已经在我这一边创建了一个示例,似乎仅使用CSS transition属性就不会更改元素的位置。解决方法是,我们可以使用the Transition on Hoverthe CSS animation Property来更改元素的位置。

请参阅this sample

<style>
    .notch {
        position: absolute;
        left: calc(95vw - 37.5px); 
        top: calc(50% - 5px); 
        width: 75px;
        height: 110px;
        box-sizing: border-box;
        font-size: 30px;
        text-align: center;
        line-height: 110px;
        transition: all 5s linear;
        -ms-transition: all 5s linear;
        -webkit-transition: all 5s linear;
        -moz-transition: all 5s linear;
        -o-transition: all 5s linear;
        -webkit-animation: mymove 5s linear; /* Safari 4.0 - 8.0 */
        animation: mymove 5s linear;
    }

    /* Safari 4.0 - 8.0 */
    @-webkit-keyframes mymove {
        from {
            left: 195vw;
        }

        to {
            left: 95vw;
        }
    }

    @keyframes mymove {
        from {
            left: 195vw;
        }

        to {
            left: 95vw;
        }
    }
</style>

输出如下:

enter image description here

本文链接:https://www.f2er.com/3154485.html

大家都在问