我有一个webkit渐变背景和背景图像中同一行代码的重复图片。喜欢
background-image:url(../images/bloobg.png), -moz-linear-gradient(bottom, #9bd5eb, #01aef0); /* FF3.6+ */
想知道我是否可以添加一个代码或任何会使bloobg.png继续向左滚动的代码。我尝试使用jQuery和Java,但我不认为我准备好了:[
-edit-我支持其他浏览器
#body { background:#9bd5eb;
background-image: url(../images/bloobg.png); /* fallback */
background-image:url(../images/bloobg.png),-webkit-gradient(linear, left top, left bottom, from(#444444), to(#999999)); /* Saf4+, Chrome */
background-image: url(../images/bloobg.png),-webkit-linear-gradient(bottom, #9bd5eb, #01aef0); /* Chrome 10+, Saf5.1+ */
background-image:url(../images/bloobg.png), -moz-linear-gradient(bottom, #9bd5eb, #01aef0); /* FF3.6+ */
background-image: url(../images/bloobg.png), -ms-linear-gradient(bottom, #9bd5eb, #01aef0); /* IE10 */
background-image: url(../images/bloobg.png), -o-linear-gradient(bottom, #9bd5eb, #01aef0); /* Opera 11.10+ */
background-image: url(../images/bloobg.png), linear-gradient(bottom, #9bd5eb, #01aef0); /* W3C */
background-attachment:fixed;
}
-edit-我尝试了这个,但没有用,你能看出是否有语法错误?出于某种原因,@-webkit-keyframes move {
是灰色的......
在CSS文件中,我放了
@-webkit-keyframes move {
0% { left: 0px; }
50% { left: 1000px; }
100% { left: 0px; }
}
@-moz-keyframes move {
0% { left: 0px; }
50% { left: 1000px; }
100% { left: 0px; }
}
然后我把
#body { background:#9bd5eb;
background-image: url(../images/bloobg.png); /* fallback */
background-image:url(../images/bloobg.png),-webkit-gradient(linear, left top, left bottom, from(#444444), to(#999999)); /* Saf4+, Chrome */
background-image: url(../images/bloobg.png),-webkit-linear-gradient(bottom, #9bd5eb, #01aef0), -webkit-animation: move 10s infinite; /* Chrome 10+, Saf5.1+ */
background-image:url(../images/bloobg.png), -moz-linear-gradient(bottom, #9bd5eb, #01aef0), -moz-animation: move 10s infinite; /* FF3.6+ */
background-image: url(../images/bloobg.png), -ms-linear-gradient(bottom, #9bd5eb, #01aef0); /* IE10 */
background-image: url(../images/bloobg.png), -o-linear-gradient(bottom, #9bd5eb, #01aef0); /* Opera 11.10+ */
background-image: url(../images/bloobg.png), linear-gradient(bottom, #9bd5eb, #01aef0); /* W3C */
background-attachment:fixed;
}
唯一改变的是渐变。现在只有一种颜色。
答案 0 :(得分:2)
使用CSS动画为background-position属性设置动画。这是一个示例(您将不得不使用浏览器前缀):
@keyframes bgMove {
0% { background-position: 0 0, 0 0; }
100% { background-position: 100% 0, 0 0; }
}
.foo {
animation: bgMove 5s infinite;
}
答案 1 :(得分:0)
您的渐变目前仅适用于一个浏览器。
body
{
background: -moz-linear-gradient(top, #9bd5eb, #01aef0);
background: -webkit-gradient(linear,left top,left bottom,color-stop(0, #9bd5eb),color-stop(1, #01aef0));
background: linear-gradient(#9bd5eb, #01aef0);
-pie-background: linear-gradient(#9bd5eb, #01aef0);
}