无法加载资源:服务器与404的服务器状态(未找到)错误回应 [英] Failed to load resource: the server responded with a status of 404 (Not Found) error in server
问题描述
我试图加载图像在我的图片文件夹,但它不工作。
I'm trying to load up image in my Image Folder, but it's not working.
调试后,我看到这样的错误:
Upon debugging, I see this error:
Failed to load resource: the server responded with a status of 404 (Not Found)
我的图像编码是在CSS文件即
My image coding is in .css file that is,
background: url("../Images/bgbody.png") no-repeat;
我在做什么错在这里?
What am I doing wrong here?
相关code为附后。
谢谢
推荐答案
使用浏览器的网络检查器(F12),看看当浏览器请求bgbody.png形象,它使用的是什么绝对路径,为什么服务器返回一个404回应。
Use your browser's network inspector (F12) to see when the browser is requesting the bgbody.png image and what absolute path it's using and why the server is returning a 404 response.
...假设bgbody.png确实存在:)
...assuming that bgbody.png actually exists :)
是你的CSS样式表文件或在<风格>在一个页面
块?如果是在样式表则相对路径必须是相对于CSS样式表(而不是引用它的文档)。如果是在一个页面中,那么它必须是相对于当前的资源路径。如果你使用非基于文件系统的资源路径(即使用URL重写或URL路由),那么这会造成问题,这是最好的总是使用绝对路径。
Is your CSS in a stylesheet file or in a <style>
block in a page? If it's in a stylesheet then the relative path must be relative to the CSS stylesheet (not the document that references it). If it's in a page then it must be relative to the current resource path. If you're using non-filesystem-based resource paths (i.e. using URL rewriting or URL routing) then this will cause problems and it's best to always use absolute paths.
去您的相对路径看起来是单独的样式表中存储图像。我不认为这是一个好主意 - 我支持存储图像和其他资源,如字体,在同一目录样式表本身,因为它简化了路径,也更符合逻辑文件系统的安排
Going by your relative path it looks like you store your images separately from your stylesheets. I don't think this is a good idea - I support storing images and other resources, like fonts, in the same directory as the stylesheet itself, as it simplifies paths and is also a more logical filesystem arrangement.
这篇关于无法加载资源:服务器与404的服务器状态(未找到)错误回应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!