0

出于某种原因,我在 css 中的整页背景不起作用。我以前做过一次,效果很好,但现在我得到的只是白色背景。这是我相关css代码的一部分:

* {
margin: 0;
padding: 0;
}

/* render html5 elements as block */
header, footer, section, aside, nav, article {
display: block;
}

html {
    line-height: 1;
    color: #555;
    font-family: 'Trebuchet MS', Verdana, Arial, Helvetica, sans-serif;
    font-size: 14px;
    background-image: url(file:///HD/Users/Barbra/Sites/HSMAI/images/vbcc_background.jpg) no-repeat center center     fixed; 
-webkit-background-size: cover;
- moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

/* layout */

#wrapper {
width: 960px;
margin: 0 auto;
background-image: linear-gradient(bottom, #86D1C7 5%, #A8BCFA 53%);
background-image: -o-linear-gradient(bottom, #86D1C7 5%, #A8BCFA 53%);
background-image: -moz-linear-gradient(bottom, #86D1C7 5%, #A8BCFA 53%);
background-image: -webkit-linear-gradient(bottom, #86D1C7 5%, #A8BCFA 53%);
background-image: -ms-linear-gradient(bottom, #86D1C7 5%, #A8BCFA 53%);

background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.05, #86D1C7),
color-stop(0.53, #A8BCFA)
);
border: 2px solid #333;
/* curved border radius */
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
padding: 10px;
margin-top: 10px;
margin-bottom: 10px;
}

我确定所有文件都在正确的位置,并且所有链接都正确指定。

4

3 回答 3

1

的值background-image只是图像的 URL。如果您输入任何其他值,则声明无效。

改变:

background-image: url(file:///HD/Users/Barbra/Sites/HSMAI/images/vbcc_background.jpg) no-repeat center center fixed;

background-image: url(file:///HD/Users/Barbra/Sites/HSMAI/images/vbcc_background.jpg)

或者

background: url(file:///HD/Users/Barbra/Sites/HSMAI/images/vbcc_background.jpg) no-repeat center center fixed;
于 2012-09-24T19:58:40.880 回答
0
background-image: url(file:///HD/Users/Barbra/Sites/HSMAI/images/vbcc_background.jpg) no-repeat center center     fixed;

应该

background: url('///HD/Users/Barbra/Sites/HSMAI/images/vbcc_background.jpg') no-repeat center fixed;
于 2012-09-24T20:06:33.950 回答
0

为 body 元素提供背景,它应该可以工作。

于 2012-09-24T19:53:07.373 回答