网站上线时,图片不会显示为背景

时间:2014-01-31 21:33:31

标签: html css css3

我正在尝试在我的网站上线时正确显示背景图片。它仅在开发环境中有效。上传后,默认为背景颜色。我已多次检查以确保正在使用正确的文件名,并且所有其他方面都按要求工作。以下是我的main.css文件中的代码。

body {
    background-color: #f2f2f2;
    font-family: "Lato";
    font-weight: 300;
    font-size: 16px;
    color: #555;
    padding-top: 150px;
    background-image: url(../img/IMG_0234.jpg);
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

当我在Google Chrome上使用Devtools时,我得到以下回复:

Failed to load resource: the server responded with a status of 404 (Not Found)     http://josejrvazquez.com/assets/img/IMG_0234.jpg
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.

该文件可在以下位置找到     http://josejrvazquez.com/assets/img/IMG_0234.JPG

2 个答案:

答案 0 :(得分:2)

你需要资金.JPG

background-image: url(../img/IMG_0234.JPG);

您的生活环境区分大小写。大多数运行网站的* nix系统在文件和文件夹名称中都区分大小写。 Windows文件结构不区分大小写。这会导致很多类似于你的混淆。

答案 1 :(得分:0)

尝试

background-image: url(../img/IMG_0234.JPG);
相关问题