这里也有人问过类似的问题HTML/CSS渐变,停止在一个特定的高度,并继续进一步与纯色,但据我所知,这并不工作时,使用它的身体作为背景色-这是我想要实现的。
具体来说,我想在页面顶部使用浅蓝色,向下渐变为深蓝色200px,然后永远使用深蓝色。
感谢所有能帮助我的人,
Alfo .
这应该能奏效。实例: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%);
}