Webkit-渐变固定度?
我用 WebKit 渐变组合了这个 CSS3 背景:
background-image: -webkit-gradient(linear, right top, left bottom,
color-stop(0.01, #B601B3),
color-stop(2%, #9106D3),
color-stop(4%, #6B16EC),
/* [...](rainbow colors) */
color-stop(96%, #2850FE),
color-stop(98%, #1175F7),
color-stop(1.0, #039BE5));
这工作正常(在 Chrome 和 Safari 中,如预期),但每次页面“变长”时它都会调整大小,它不会以相同的程度和渐变进行调整经常被拖很多。
有没有办法让线性渐变朝固定方向“走”?你能在 moz-linear-gradient
中做同样的事情吗?
I have composed this CSS3-background with the WebKit-gradient:
background-image: -webkit-gradient(linear, right top, left bottom,
color-stop(0.01, #B601B3),
color-stop(2%, #9106D3),
color-stop(4%, #6B16EC),
/* [...](rainbow colors) */
color-stop(96%, #2850FE),
color-stop(98%, #1175F7),
color-stop(1.0, #039BE5));
This works fine (in Chrome and Safari, as expected), but it resizes every time the page "gets longer", it doesn't go in the same degree and the gradient often gets dragged a lot.
Is there any way to make a linear-gradient "go" in a fixed direction? And can you do the same in moz-linear-gradient
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终这样做了,支持所有现代浏览器(Safari、Chrome、Firefox 和 Opera):
实时查看:http:// /jsfiddle.net/z8w2N
对于未来的搜索者来说,这是一个完美的彩虹渐变! :)
I ended up doing it like this, supporting all modern browsers (Safari, Chrome, Firefox and Opera):
See it live: http://jsfiddle.net/z8w2N
This is a perfect rainbow-gradient for future searchers! :)