【发布时间】:2012-02-14 22:36:29
【问题描述】:
我在 background-image 的同一行代码中有一个 webkit 渐变背景和一个重复图片。喜欢
background-image:url(../images/bloobg.png), -moz-linear-gradient(bottom, #9bd5eb, #01aef0); /* FF3.6+ */
想知道我是否可以再添加一个代码或任何使 blobg.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;
}
唯一改变的是渐变。现在只有一种颜色。
【问题讨论】:
-
“继续向左滚动”?你的意思是
background-position:fixed;? -
这会让我的图片一直向左循环吗?并离开屏幕?
-
相对于视口,图片不会移动。您想获得动画背景吗?
-
我有背景附件:已修复;我相信这会阻止渐变顶部的图像随着内容滚动,但我喜欢让它向左移动,编辑perciecly
-
您可以使用
background-positionCSS 属性定期移动背景。必须支持哪些浏览器?
标签: html css background background-image