CSS3的背景图像转换 [英] CSS3 background image transition

查看:182
本文介绍了CSS3的背景图像转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让使用CSS过渡淡入淡出的效果。但我不能得到这个与背景图像工作...

I'm trying to make a "fade-in fade-out" effect using the CSS transition. But I can't get this to work with the background image...

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/

感谢您的帮助。

推荐答案

您可以过渡背景图片。使用下面的CSS的 IMG 元素:

You can transition background-image. Use the CSS below on the img element:

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

这是由Chrome,Opera和Safari原生支持。 Firefox有没有实现它( bugzil.la )。不知道IE浏览器。

This is supported natively by Chrome, Opera and Safari. Firefox hasn't implemented it yet (bugzil.la). Not sure about IE.

这篇关于CSS3的背景图像转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆