background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,#ff2f0f), color-stop(50%,#f42f58));
background: -webkit-linear-gradient(45deg, #ff2f0f 0%,#f42f58 50%);
我们现在所拥有的Exmaple on jsfiddle。
我们想知道是否可以慢慢为背景设置动画以使其更有趣,而不仅仅是显示静态渐变。欢迎任何想法!
答案 0 :(得分:3)
这是一个旋转的渐变背景。 http://jsfiddle.net/f5v5d/
HTML
<div id="bgwrap"><div id="bg"></div></div>
<h3>Fancy Backgrounds For Everyone!</h3>
CSS
#bgwrap {
position:fixed;
left:0;top:0;right:0;bottom:0;
overflow: visible;
z-index:-1;
}
#bg {
position:absolute;
left:0;top:0;width:100%;height:100%;
padding:0;margin:0;
border-radius: 50%;
background: linear-gradient(45deg, red, gray, red);
animation: spin 5s linear infinite;
-moz-animation: spin 5s linear infinite;
-webkit-animation: spin 5s linear infinite;
-ms-animation: spin 5s linear infinite;
}
@keyframes spin {
from { transform: scale3d(2,2,1) rotateZ(0deg); }
to { transform: scale3d(2,2,1) rotateZ(360deg); }
}
@-moz-keyframes spin {
from { -moz-transform: scale3d(2,2,1) rotateZ(0deg); }
to { -moz-transform: scale3d(2,2,1) rotateZ(360deg); }
}
@-webkit-keyframes spin {
from { -webkit-transform: scale3d(2,2,1) rotateZ(0deg); }
to { -webkit-transform: scale3d(2,2,1) rotateZ(360deg); }
}
@-ms-keyframes spin {
from { -ms-transform: scale3d(2,2,1) rotateZ(0deg); }
to { -ms-transform: scale3d(2,2,1) rotateZ(360deg); }
}
答案 1 :(得分:0)