src =" /images/logo.gif"有什么区别?和src =" images / logo.gif" ;? [英] What is the difference between src="/images/logo.gif" and src="images/logo.gif"?
问题描述
< img src =images / logo.gif/>
相当于
但是
不同。
第三个项目在哪里寻找logo.gif
b$ b
这是相对的,意思是:转到名为 images 的文件夹,然后获取资源 logo.gif
./ images / logo.gif 当前文件夹(点表示这个)转到名为 images 的文件夹,然后获取资源 logo.gif
<正如你所看到的,前两个意思是相同的,最后是最后一个。
这是绝对的,意味着:从Web服务器或文件系统的根目录或其他任何(斜杠意味着这一点)转到名为图像的文件夹,然后获取资源 logo.gif
<img src="images/logo.gif" />
is equivalent to
<img src="./images/logo.gif" />
But
<img src="/images/logo.gif" />
is different.
Where is the third item looking for logo.gif?
images/logo.gif
It's relative and means: Go to a folder called images and then get the resource logo.gif
./images/logo.gif
It's relative and means: From the current folder (the dot means this) go to a folder called images and then get the resource logo.gif
As you can see the first two mean the same, finally the last one
/images/logo.gif
It's absolute and means: From the root of the web server or the file system or whatever (the slash means this) go to a folder called images and then get the resource logo.gif
这篇关于src =" /images/logo.gif"有什么区别?和src =" images / logo.gif" ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!