微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

CSS3 Transitions不支持RGBA Background属性吗?

我正在尝试以下代码,但我没有看到任何类型的过渡.
#menu .col_1 a{
    -webkit-transition: all .5s ease-out 0.1s;
    -moz-transition: all .5s ease-out 0.1s;
    -o-transition: all .5s ease-out 0.1s;
    transition: all .5s ease-out 0.1s;
}

#menu .col_1 a:hover{
    background-color: rgb(255,255,255);
    background-color: rgba(255,0.5);
    /* For IE 5.5 - 7*/
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,endColorstr=#99000000);
    /* For IE 8*/
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,endColorstr=#99000000)";
}

我搞砸了什么或是不支持这种转变?悬停工作正常,我只是没有看到任何转换.

解决方法

CSS3支持RGBA背景.您需要为初始状态提供后台属性,以便在悬停状态下更改.

这是您需要的代码

#menu .col_1 a {
-webkit-transition: all .5s ease-out 0.1s;
-moz-transition: all .5s ease-out 0.1s;
-o-transition: all .5s ease-out 0.1s;
transition: all .5s ease-out 0.1s;
background-color: rgba(0,1);
color: red;
}

#menu .col_1 a:hover {
background-color: rgb(255,255);
background-color: rgba(255,0.5);
/* For IE 5.5 - 7*/
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,endColorstr=#99000000);
/* For IE 8*/
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,endColorstr=#99000000)";

}

如果你需要的话,可以使用它:http://jsfiddle.net/TAMA2/

原文地址:https://www.jb51.cc/css/214857.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。