CSS3背景过渡效果

3
所以我想要重新创建那个带有丝带转换效果的网站http://subtlepatterns.com/,但是我做错了些什么。我的丝带图片大小为140x160 [宽度,高度],但悬停时没有任何反应。
我放置了:
#toplogo {
    position: absolute;
    left: 400px;
    background-position: 0px -10px;
    z-index: 5000;
}


#toplogo a {
    background: url('ribbon.png') no-repeat;
    width: 140px;
    height: 160px;
    display: block;
    background-position: 0px -10px;
    text-indent: -9999px;
    -webkit-transition: 0.10s ease-in;
    -moz-transition: 0.10s ease-in;
}



<div id="toplogo"> <a href="/">hello</a> </div>
2个回答

2
在CSS中添加以下内容 -
#toplogo a:hover{
  background-position: 0px 0px;
}

1

尝试

#toplogo a {
    background: url('ribbon.png') no-repeat;
    width: 140px;
    height: 160px;
    display: block;
    background-position: 0px -10px;
    text-indent: -9999px;
    -webkit-transition: background-position .1s ease-in;
    -moz-transition: background-position .1s ease-in;
}

#toplogo a:hover {
  background-position: 0 0;
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接