3

此处已提出与此问题类似的问题- HTML/CSS Gradient 停止在特定高度并继续以纯色继续,但据我所知,在将其用于背景颜色时,这不起作用- 这就是我想要实现的。

具体来说,我希望它在页面顶部为浅蓝色,再向下渐变为深蓝色 200 像素,然后永远保持深蓝色。

感谢任何可以提供帮助的人,

阿尔福。

4

1 回答 1

3

这应该可以解决问题。现场示例:http: //jsfiddle.net/tw16/mBUZt/

我使用了最新的 css3 渐变格式:

html,body{height: 100%} /* added this as the example is an empty page */
body{
    background:    -moz-linear-gradient(top, #319ef7 0%,#1b388e 200px,#1b388e 100%);
    background: -webkit-linear-gradient(top, #319ef7 0%,#1b388e 200px,#1b388e 100%);
    background:      -o-linear-gradient(top, #319ef7 0%,#1b388e 200px,#1b388e 100%);
    background:     -ms-linear-gradient(top, #319ef7 0%,#1b388e 200px,#1b388e 100%);
    background:         linear-gradient(top, #319ef7 0%,#1b388e 200px,#1b388e 100%);
}
于 2011-11-19T17:45:03.533 回答