Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 背景图像赢得';不要重复全高度_Html_Css - Fatal编程技术网

Html 背景图像赢得';不要重复全高度

Html 背景图像赢得';不要重复全高度,html,css,Html,Css,你可以看到我的问题。背景图像设置为重复整个高度,但它不能按需要工作 我的CSS #wrapper { margin: 0px; padding: 0px; background: url(img02.jpg) repeat-x left top; } 我试着加上这些线 body { margin: 0; padding: 0; background: #F7F7F7 url(img01.jpg) repeat left top; fon

你可以看到我的问题。背景图像设置为重复整个高度,但它不能按需要工作

我的CSS

#wrapper {
    margin: 0px;
    padding: 0px;

    background: url(img02.jpg) repeat-x left top;
}
我试着加上这些线

body {
    margin: 0;
    padding: 0;
    background: #F7F7F7 url(img01.jpg) repeat left top;
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 14px;
    color: #5A554E;

/* theese lines added*/ 
        min-height:100%;
      height:auto;

}

但是背景图像仍然不会重复所有高度。

您只设置了repeat-x,它告诉它在x轴上重复,但是重复这种渐变图像会导致非常难看的背景。相反,如果可能的话,我建议用css来完成这一切

生成CSS渐变的许多有用工具之一:
如果要拉伸背景以填充页面,请使用:

background-size: 100%;

否则,如果要重复,请使用Erik的答案。

您只设置了repeat-x,这会告诉它在x轴上重复