src =" /images/logo.gif"有什么区别?和src =" images / logo.gif&quot ;? [英] What is the difference between src="/images/logo.gif" and src="images/logo.gif"?

查看:450
本文介绍了src =" /images/logo.gif"有什么区别?和src =" images / logo.gif&quot ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 
< 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 =&quot; /images/logo.gif&quot;有什么区别?和src =&quot; images / logo.gif&quot ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆