简体   繁体   English

CSS过渡不适用于IE

[英]CSS transition not working in IE

I cant get this transition working in IE or Firefox, It looks fine in Safari and Chrome. 我无法在IE或Firefox中进行此转换,在Safari和Chrome中看起来很不错。 The opacity shows but is instant. 不透明度显示但是是即时的。
To me the below CSS looks right and I can't see any reason that it would work in either IE or firefox. 对我来说,下面的CSS看起来是正确的,我看不出任何理由它可以在IE或Firefox中工作。
I've tried this using -ms-transition and it yields the same results, but the site uses CSS3 anyway so shouldn't need the -ms- anyway from what I've read. 我已经尝试过使用-ms-transition并且它会产生相同的结果,但是网站仍然使用CSS3,所以不管怎样我都不需要-ms-。
Any light that can be shed would be greatly appreciated! 任何可以脱落的灯都将非常感激!
Ben

CSS: CSS:

.XMABAN {   
    height: 153px;  
    width: 230px;  
    background-color:rgb(127,0,25);  
    padding: 0;  
    vertical-align: top;  
}

.XMABAN a {  
    height: 153px;  
    width: 230px;  
    text-decoration:none;  
}

.XMABAN a:hover         {   
    text-decoration:none;   
}

.XMABAN img             {   
    opacity: 1;  
    transition: opacity 0.70s ease-in-out;   
    -moz-transition: opacity 0.70s ease-in-out;  
    -webkit-transition: opacity 0.70s ease-in-out; 
    -o-transition: opacity 0.70s ease-in-out; 
}

.XMABAN a:hover img     {   
    opacity: 0.30;  
    transition: opacity 0.25s ease-in-out;  
    -moz-transition: opacity 0.25s ease-in-out;  
    -webkit-transition: opacity 0.25s ease-in-out;  
    -o-transition: opacity 0.25s ease-in-out;  
}

.XMABAN span            {   
    position: relative;  
    left: 0%;  
    top: -62%;  
    font-weight:bold;  
    font-size:20pt;  
    color:#404040;  
    transition: color 0.70s ease-in-out;  
    -moz-transition: color 0.70s ease-in-out;  
    -webkit-transition: color 0.70s ease-in-out;  
    -o-transition: color 0.70s ease-in-out;  
}

.XMABAN a:hover span    {   
    color:#FFF0F5;  
    transition: color 0.25s ease-in-out;  
    -moz-transition: color 0.25s ease-in-out;  
    -webkit-transition: color 0.25s ease-in-out;  
    -o-transition: color 0.25s ease-in-out;  
}

HTML: HTML:

<tr>
    <td style="width: 33%;">
        <div class="XMABAN" style="margin: 10px 0px 5px 0px;">
            <a class="DSPI" href="online.asp">
                <img src="../images/PRM_220.jpg">
                <span>TEXT</span>
            </a>
        </div>
    </td>
</tr>

CSS Transitions are not supported in IE9 or lower . IE9或更低版本不支持 CSS转换。 They are supported in IE10, however, and the CSS you've included does work correctly in IE10. 但是,它们在IE10中受支持,并且您包含的CSS在IE10中可以正常工作。

I can only assume you're using IE10 with IE9 standards to test this, which is why the transition isn't working. 我只能假设您正在使用IE9和IE9标准来测试这一点,这就是转换无效的原因。 To change this, simply set IE's Document Mode to Standards: 要更改此设置,只需将IE的文档模式设置为标准:

IE演示

It's also worth noting that you should always include vendor prefixing before the intended CSS property. 还值得注意的是,您应该始终在预期的CSS属性之前包含供应商前缀。 Specifying transition before -webkit-transition , for instance, will tell WebKit-based browsers to use the prefixed version instead of the actual version, and there may be differences in how each are handled. 例如,在-webkit-transition transition之前指定transition将告诉基于WebKit的浏览器使用前缀版本而不是实际版本,并且每个处理方式可能存在差异。 Change your CSS to: 将您的CSS更改为:

-moz-transition: ...;
-webkit-transition: ...;
-o-transition: ...;
transition: ...;

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

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