简体   繁体   English

相对图像路径不起作用(HTML)

[英]Relative image path not working(HTML)

I cant seem to get my image to display on my webpage using a relative path. 我似乎无法使用相对路径将图像显示在网页上。 Im using the program "brackets" to do all of my editing before uploading to the webpage. 我在上传到网页之前使用程序“括号”进行了所有编辑。 Below is the relative path that i'm using and when I hover over the path the image thumbnail displays. 以下是我正在使用的相对路径,当我将鼠标悬停在图像缩略图显示的路径上时。 but it still wont display on the page... am I missing anything? 但它仍不会显示在页面上...我有什么遗漏吗? please and thank you. 谢谢,麻烦您了。

<img id="01" class ="tn leftcol" width = "150" height = "150" 
src=".//Images/IMG_3604.JPG" alt="1" /> 

there are two slashes. 有两个斜线。 this can be interpreted as a protocol. 这可以解释为协议。 Change the src to Images/IMG_3604.JPG src更改为Images/IMG_3604.JPG

If this is being populated via a variable, check the source text or environments 如果通过变量填充,请检查源文本或环境

There are two forward slashes. 有两个正斜杠。 It should be ./Images/xxxxx.png not .// 它应该是./Images/xxxxx.png而不是.//

If you have to go out of a directory, use ../ if the image folder is in the folder you are currently in use nothing. 如果必须离开目录,请使用../如果图像文件夹位于您当前正在使用的文件夹中,则不使用。

Src="Images/IMG_3604.JPG" Src =“ Images / IMG_3604.JPG”

Your html file is in the same directory. 您的html文件位于同一目录中。

Src="../Images/IMG_3604.JPG" Src =“ ../ Images / IMG_3604.JPG”

Html file is in a subdirectory and you need to go outside of that folder to get to images. HTML文件位于子目录中,您需要移出该文件夹才能访问图像。

Src="../../Images/IMG_3604.JPG" Src =“ ../../ Images / IMG_3604.JPG”

Html is in a subdirectory of a subdirectory and you need to go outside of both to get to the Images folder. HTML位于子目录的子目录中,您需要同时进入这两个目录才能进入Images文件夹。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM