【发布时间】:2019-07-09 16:58:53
【问题描述】:
我正在建立一个响应式网站,在添加响应式导航后,分配给 div“.hero-image”的背景图像不再存在。 Google chrome 控制台出现错误“加载资源失败:服务器响应状态为 404(未找到)”
图片位于“img/Header.jpg”下
检查了我的新导航栏冲突代码,找不到问题。 仔细检查文件位置
CSS
.hero-image{
background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url("img/Header.jpg");
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
}
.hero-text{
text-align: left;
position: absolute;
margin-left: 20%;
color: white;
font-family: 'Roboto Mono', monospace;
}
*{
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
nav{
display: flex;
justify-content: space-around;
align-items: center;
min-height: 8vh;
background-color: #343434;
font-family: 'Roboto Mono', monospace;
}
#logo{
height: 100px;
}
.nav-links{
display: flex;
justify-content: space-around;
width: 30%;
}
.nav-links li{
list-style: none;
}
.nav-links a{
color: white;
text-decoration: none;
letter-spacing: 3px;
font-weight: bold;
}
.burger{
display: none;
cursor: pointer;
}
.burger div{
width: 25px;
height: 3px;
background-color: white;
margin: 5px;
transition: all 0.3s ease;
}
@media screen and (max-width: 1024px){
.nav-links{
width: 60%;
}
}
@media screen and (max-width: 768px){
body{
overflow-x: hidden;
}
.nav-links{
position: absolute;
right: 0px;
height: 100vh;
top: 0vh;
background-color: #3f3f3f;
display: flex;
flex-direction: column;
align-items: center;
width: 80%;
height: 100%;
transform: translateX(100%);
transition: transform 0.5s ease-in;
}
.nav-links li{
opacity: 0;
}
.burger{
display: block;
}
}
.nav-active{
transform: translateX(0%);
}
@keyframes navLinkFade{
from{
opacity: 0;
transform: translateX(50px);
}
to{
opacity: 1;
transform: translateX(0px);
}
}
.toggle .line1{
transform: rotate(-45deg) translate(-5px,6px);
}
.toggle .line2{
opacity: 0;
}
.toggle .line3{
transform: rotate(+45deg) translate(-5px,-6px);
}
HTML
<div class="hero-text">
<h1>Ruan Kuypers</h1>
<h2>Websites. Done. Right.</h2>
<h3>A relighable business partner.</h3>
</div>
</div>
加载资源失败:服务器响应状态为 404(未找到)
【问题讨论】:
-
你试过
/img/Header.jpg吗? -
@LeeTaylor 是的,我有,但仍然没有;(
-
@epascarello 我试过了,但还是不行。
-
请编辑您的问题并包含您的 css、html 和图像文件夹/文件的层次结构
标签: javascript html css