gpt4 book ai didi

CSS3 淡入淡出效果

转载 作者:技术小花猫 更新时间:2023-10-29 10:19:51 25 4
gpt4 key购买 nike

a {
float: left;
width: 32px;
height: 32px;
text-align: left;
text-indent:-9999px;
background: url('../img/button.png') no-repeat 0 0;

-webkit-transition: background 300ms ease-in 2s; /* property duration timing-function delay */
-moz-transition: background 300ms ease-in 2s;
-o-transition: background 300ms ease-in 2s;
transition: background 300ms ease-in 2s;


-webkit-transition-property: background;
-webkit-transition-duration: 300ms;
-webkit-transition-timing-function: ease-in;
-webkit-transition-delay: 100ms;

-moz-transition-property: background;
-moz-transition-duration: 300ms;
-moz-transition-timing-function: ease-in;
-moz-transition-delay: 100ms;

-o-transition-property: background;
-o-transition-duration: 300ms;
-o-transition-timing-function: ease-in;
-o-transition-delay: 100ms;

transition-property: background;
transition-duration: 300ms;
transition-timing-function: ease-in;
transition-delay: 100ms;

}

a:hover {
background:position: 0 -32px;
}

..目前它有向上/向下滚动效果,但我希望背景随着淡入淡出效果而改变,我应该在 CSS 中更改什么?

谢谢!

最佳答案

您不能在两个背景图像之间转换,因为浏览器无法知道您想要插入什么。正如您所发现的,您可以转换背景位置。如果您希望图像在鼠标悬停时淡入,我认为使用 CSS 过渡的最佳方法是将图像放在包含元素上,然后将链接本身的背景颜色设置为透明动画:

span {
background: url(button.png) no-repeat 0 0;
}
a {
width: 32px;
height: 32px;
text-align: left;
background: rgb(255,255,255);

-webkit-transition: background 300ms ease-in 200ms; /* property duration timing-function delay */
-moz-transition: background 300ms ease-in 200ms;
-o-transition: background 300ms ease-in 200ms;
transition: background 300ms ease-in 200ms;
}
a:hover {
background: rgba(255,255,255,0);
}

关于CSS3 淡入淡出效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3079330/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com