fade background images with css3

血红的双手。 提交于 2020-01-11 07:25:10

问题


Hey everyone... Im wondering why this wont work?

.right-article.boy {
    background: transparent url(../images/boxes-bg/boy.jpg) left top no-repeat;
    width: 413px;
    height: 242px;
    -webkit-transition: background 1.5s linear;
    -moz-transition: background 1.5s linear;
    transition: background 1.5s linear;
}

.right-article.boy:hover {
    background: transparent url(../images/boxes-bg/boy-hover.jpg) left top no-repeat;
}

If i change the background to colors like yellow and the hover, black, it works fine.... But not with my images?


回答1:


Have a look at http://css3.bradshawenterprises.com/cfimg/ – I wrote this tutorial to help people with issues like this!




回答2:


i can't imagine how image would change during 1.5s.
i would do this a little bit different:
http://jsfiddle.net/seler/48BM4/1/ or http://jsfiddle.net/seler/48BM4/2/

with images it would work like that: http://jsfiddle.net/seler/48BM4/3/

another example iwth auto height and no need to duplicate content:
http://jsfiddle.net/seler/48BM4/7/



来源:https://stackoverflow.com/questions/5947582/fade-background-images-with-css3

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!