【发布时间】:2017-05-01 12:16:21
【问题描述】:
好的,我不能对任何其他问题发表评论,这就是我发布新问题的原因。
我已经尝试了this 答案和this 中建议的所有解决方案。
#head {
text-align: center;
font-family: roboto;
}
body, html {
height: 100%;
}
.parallax {
background-image: url('.../pics/parallax.jpg');
height: 100%;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="css/animate.css">
<link rel="stylesheet" href="css/text.css">
<script src="scripts/jquery-3.1.0.min.js"></script>
<script src="scripts/jquery.animate-color.js"></script>
<script src="scripts/custom_scripts.js"></script>
<title>Yadullah.me</title>
</head>
<body>
<h1 id="head"> Hi there!</h1>
</body>
</html>
很简单吧?但由于某种原因,背景图片只是拒绝显示。
我尝试在同一个文件夹中使用我的 CSS、HTML 和图像,但没有成功。在不同的子目录中尝试过,没有成功。
我已经检查了文件名、扩展名和所有这些内容。尝试不带引号和不带引号的东西。甚至尝试了不同的图像。也尝试删除所有其他 CSS 文件,但没有任何效果。
【问题讨论】:
-
看起来图像路径中的一个点太多了......
-
要详细说明GCyrillus的评论,
url('.../pics/parallax.jpg');应该是url('../pics/parallax.jpg'); -
@Santi 不幸的是,这也没有用
-
@YaddyVirus 告诉我们更多关于您的文件结构的信息。与您要检索的图像相关的 CSS 文件在哪里?
-
@Santi 我的 f: 驱动器上有一个名为 Yadullah.me 的文件夹,该文件夹有 3 个子文件夹,即 css、scripts 和 pics。 html 位于根文件夹中(即 Yadullah.me 文件夹)