1

有没有办法仅将 css3 过渡用于文本颜色?

假设我有一个readmore类有一些过渡效果,比如

.readmore{
    colour:red;
    -webkit-transition: all .3s ease-out;
    -moz-transition: all .3s ease-out;
    -o-transition: all .3s ease-out;
    transition: all .3s ease-out;
    background:url(images/sprite.png) no-repeat 0 0;

}



.readmore:hover{
    colour:red;
    background:url(images/sprite.png) no-repeat 0 -20px;
}

现在我不想应用背景图像过渡。我只需要为颜色应用过渡。因为当我们将鼠标悬停在文本上时,图像正在动画并且看起来不太好。

有什么建议吗?提前致谢。

4

2 回答 2

1

all您可以指定只想转换属性,而不是指定要转换color属性。

像这样:

transition: color .3s ease-out; 

并更改colourcolor.

希望这可以帮助!

于 2013-11-04T07:03:18.087 回答
0

使用此选项:

transition-property:color;
于 2013-11-04T06:58:35.353 回答