css/html:获取本地主机的正确背景图像路径
我正在使用一个web开发程序(Aptana),当我运行html页面时,它会在这里运行:css/html:获取本地主机的正确背景图像路径,html,css,Html,Css,我正在使用一个web开发程序(Aptana),当我运行html页面时,它会在这里运行: http://127.0.0.1:8000/RadiantOrigins/index.html 现在,在index.html文件中,head元素的顶部有style/css: body { /* background-color: red; */ background-image: url('../EverythingImportant.jpg'); } 好的,谢谢,我可以把图像放在inde
http://127.0.0.1:8000/RadiantOrigins/index.html
现在,在index.html文件中,head元素的顶部有style/css:
body {
/* background-color: red; */
background-image: url('../EverythingImportant.jpg');
}
好的,谢谢,我可以把图像放在index.html文件所在的目录下,它会找到它
但是如果我把EverythingImportant.jpg放在images目录下,项目所在的子目录下,这些都不起作用:
background-image: url('images/EverythingImportant.jpg');
background-image: url('/images/EverythingImportant.jpg');
background-image: url('./images/EverythingImportant.jpg');
background-image: url('../images/EverythingImportant.jpg');
嗯,仔细检查一下。是的,一个都没有用。试试看
background-image: url('../EverythingImportant.jpg');
Aptana直到您刷新工具中的文件内容后才会看到图像。因此,即使你有图像,它也无法识别 css中的图像路径是相对于.css文件位置的。您的正文规则有一个右括号,不是吗?(它不在那里…)不是“背景重现”,而是“背景重复”?我有关闭功能,是的。如果我使用C:/…将html文件放在磁盘上的位置,它可以工作只是不确定为什么它不能与LocalHost一起工作我的样式在文档中内联,在顶部只需在浏览器中输入图像url并检查url是否工作如果我这样做,它会说它没有找到url可能是错误的,然后仔细检查fi图片和家长文件夹的名称谢谢,良好的反馈,请查看问题下的评论