如何找到css的图像路径
我是 css 和 Bootstrap 的新手,很抱歉,如果有愚蠢的问题.
I am new for for css and Bootstrap so sorry if silly question.
我想在我的项目中使用 Bootstrap.我找到了一个教程并打算遵循.在教程中有一个文件夹,当我运行 index.html
文件时,您可以看到带有徽标的页面.
I want to use the Bootstrap in my project. I found a tutorial and going to follow. In the tutorial There is a folder and when I run the index.html
file then you can see page with the logo.
我正在尝试在我的项目中使用引导程序和 css.我尝试在我的项目中使用 main.phtml
我先运行我的文件,但我看不到 logo
(image) 和 我在想问题是 .css
文件的路径
I am trying to use the bootstrap and css in my project. I tried make same in my project with main.phtml
I run my file first and I could not see the logo
(image) and I was thinking the problem is the path of .css
file
问题是当我将我的 html 文件放在任何目录而不是主项目(没有任何目录)下时,我看不到徽标.
The problem is when I put my html file in any directory rather than under main project(no any directory) I cannot see the logo.
下面前两张截图是教程文件截图,后两张截图是我的文件截图.(我没有分享任何代码,因为 css 和 html 文件正在工作)
Below first two screenshot is the tutorial file screenshots and the second two screenshot is the my file screenshots. (I did not share any code because the css and html files are working)
有人可以向我解释为什么我们不能使用目录中的 html 文件,如果可以,我们该如何管理?
Can someone explain to me why we cannot use the html files in directory or if yes how can we manage?
但是当我尝试添加我的项目时,我看不到徽标.
but when I try to add my project I cannot see the logo.
和视图;
编辑
请在此处查看:
https://stackoverflow.com/a/20047417/6284581
您不必移动 .html
文件
您的示例 css
和 img
路径未正确说明.
Your example css
and img
path not state correctly.
../
表示向上一个文件目录(查看上面的链接)!在您的示例中,如果您从web...
然后你需要进入主项目目录.试试这个
../
means one file directory up(check link above)! In your example if you start from
web...
then you need to go main project directory. Try this
<a class="navbar-brand" href="#"><img src="../web/static/style/img/logo.png"></a>
希望对你有帮助