相关疑难解决方法(0)

在悬停事件上设置CSS渐变背景的动画

我有一些使用以下样式在悬停时使用背景渐变设置样式的菜单项:

#sidebar ul li a:hover {
    background-image: linear-gradient(bottom, rgb(68,68,68) 5%, rgb(51,51,51) 100%);
    background-image: -o-linear-gradient(bottom, rgb(68,68,68) 5%, rgb(51,51,51) 100%);
    background-image: -moz-linear-gradient(bottom, rgb(68,68,68) 5%, rgb(51,51,51) 100%);
    background-image: -webkit-linear-gradient(bottom, rgb(68,68,68) 5%, rgb(51,51,51) 100%);
    background-image: -ms-linear-gradient(bottom, rgb(68,68,68) 5%, rgb(51,51,51) 100%);

    background-image: -webkit-gradient(
        linear,
        left bottom,
        left top,
        color-stop(0.05, rgb(68,68,68)),
        color-stop(1, rgb(51,51,51))
    );
    color: #f0f0f0;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}
Run Code Online (Sandbox Code Playgroud)

我的问题是,是否可以使用CSS3过渡或动画从右侧滑入新背景(由渐变定义)?或者我将不得不求助于使用精灵图像或Javascript?

html css

2
推荐指数
1
解决办法
4万
查看次数

标签 统计

css ×1

html ×1