My css gradient doesn't stretch, it repeats

浪子不回头ぞ 提交于 2019-11-30 00:09:06

Your original code: http://jsfiddle.net/ecKR4/7/

If you want the gradient to stretch the entire height of the page:

html {
    min-height: 100%
}

With little content: http://jsfiddle.net/ecKR4/1/
With lots of content: http://jsfiddle.net/ecKR4/2/

If you want the gradient to be fixed and as high as the viewport:

html {
    height: 100%
}
body {
    background-attachment: fixed
}

With little content: http://jsfiddle.net/ecKR4/3/
With lots of content: http://jsfiddle.net/ecKR4/4/

If you want the gradient to be as high as the viewport, and then the background colour:

html {
    height: 100%
}
body {
    background-repeat: no-repeat;
    background-color: #669966; /* ending colour of gradient */
}

With little content: http://jsfiddle.net/ecKR4/5/
With lots of content: http://jsfiddle.net/ecKR4/6/

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!