Closed. This question is off-topic。它当前不接受答案。
想改善这个问题吗? Update the question,所以它是on-topic,用于堆栈溢出。
4年前关闭。
我正在使用一个Web开发程序(Aptana),当我运行html页面时,它将在此处运行它:
现在,在我的index.html文件中,head元素的顶部是style / css:
好的,谢谢,我可以将图像放置在与index.html文件相同的目录下,并找到它。
但是,如果我将EverythingImportant.jpg放在图像目录(项目所在的子目录)下,则这些都不起作用:
嗯,仔细检查。是的,没有工作。
想改善这个问题吗? Update the question,所以它是on-topic,用于堆栈溢出。
4年前关闭。
我正在使用一个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');
}
好的,谢谢,我可以将图像放置在与index.html文件相同的目录下,并找到它。
但是,如果我将EverythingImportant.jpg放在图像目录(项目所在的子目录)下,则这些都不起作用:
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');