全屏背景颜色css3

Law*_*ith 4 html5 css3

在此输入图像描述我有一个渐变作为背景颜色,但它只是重复.我希望渐变拉伸到全屏,因此无法缩小并查看任何空白区域或重复渐变.

这是我身体的css

body {
text-align:center;
background: rgb(238,238,238); /* Old browsers */
background: -moz-linear-gradient(top,  rgba(238,238,238,1) 0%, rgba(89,89,89,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(238,238,238,1)), color-stop(100%,rgba(89,89,89,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  rgba(238,238,238,1) 0%,rgba(89,89,89,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  rgba(238,238,238,1) 0%,rgba(89,89,89,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  rgba(238,238,238,1) 0%,rgba(89,89,89,1) 100%); /* IE10+ */
background: linear-gradient(to bottom,  rgba(238,238,238,1) 0%,rgba(89,89,89,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#595959',GradientType=0 ); /* IE6-9 */
}
Run Code Online (Sandbox Code Playgroud)

小智 11

尝试设置高度和宽度,body并尝试使用background-attachment:

html, body
{
    width: 100%;
    height: 100%;
}
body
{
    …
    width: 100%;
    height: 100%;
    background-attachment: fixed;
}
Run Code Online (Sandbox Code Playgroud)