gpt4 book ai didi

CSS3 背景图像过渡

转载 作者:行者123 更新时间:2023-11-28 03:00:02 25 4
gpt4 key购买 nike

我正在尝试使用 CSS 过渡制作“淡入淡出”效果。但是我无法让它与背景图片一起使用...

CSS:

.title a {
display: block;
width: 340px;
height: 338px;
color: black;
background: transparent;
/* TRANSITION */
-webkit-transition: background 1s;
-moz-transition: background 1s;
-o-transition: background 1s;
transition: background 1s;
}

.title a:hover {
background: transparent;
background: url(https://lh3.googleusercontent.com/-p1nr1fkWKUo/T0zUp5CLO3I/AAAAAAAAAWg/jDiQ0cUBuKA/s800/red-pattern.png) repeat;
/* TRANSITION */
-webkit-transition: background 1s;
-moz-transition: background 1s;
-o-transition: background 1s;
transition: background 1s;
}​

看看:http://jsfiddle.net/AK3La/

最佳答案

您可以转换background-image。在 img 元素上使用下面的 CSS:

-webkit-transition: background-image 0.2s ease-in-out;
transition: background-image 0.2s ease-in-out;

这由 Chrome、Opera 和 Safari 原生支持。 Firefox 尚未实现它 ( bugzil.la )。不确定 IE。

关于CSS3 背景图像过渡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46258894/

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