1

我在 colorzilla 中生成了渐变背景,并将其放入 css 文件中,正如您在这段代码中看到的那样,它不断重复我的背景。我希望这个背景从它开始到页面结束。

body{
    background: #1d6fa4;
    background: -moz-linear-gradient(-45deg,  #1d6fa4 1%, #499bc8 26%, #51abc9 52%, #3e94c1 74%, #277cad 100%);
    background: -webkit-gradient(linear, left top, right bottom, color-stop(1%,#1d6fa4), color-stop(26%,#499bc8), color-stop(52%,#51abc9), color-stop(74%,#3e94c1), color-stop(100%,#277cad));
    background: -webkit-linear-gradient(-45deg,  #1d6fa4 1%,#499bc8 26%,#51abc9 52%,#3e94c1 74%,#277cad 100%);
    background: -o-linear-gradient(-45deg,  #1d6fa4 1%,#499bc8 26%,#51abc9 52%,#3e94c1 74%,#277cad 100%);
    background: -ms-linear-gradient(-45deg,  #1d6fa4 1%,#499bc8 26%,#51abc9 52%,#3e94c1 74%,#277cad 100%);
    background: linear-gradient(135deg,  #1d6fa4 1%,#499bc8 26%,#51abc9 52%,#3e94c1 74%,#277cad 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1d6fa4', endColorstr='#277cad',GradientType=1 );
}

重复背景

4

1 回答 1

3

你需要这个

html, body {
   height: 100%;
}

body {
   background-position: fixed;
   /* Gradient dump goes here */
}
于 2013-03-21T18:32:58.193 回答