CSS3背景转换

时间:2012-06-15 11:55:23

标签: css3 transitions

所以我想重新创建那个功能区转换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 个答案:

答案 0 :(得分:2)

在CSS中添加它 -

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

答案 1 :(得分: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;
}