What is the difference between src=“/images/logo.gif” and src=“images/logo.gif”?

前端 未结 3 1312
余生分开走
余生分开走 2020-12-18 04:54

is equivalent to


But



        
3条回答
  •  天涯浪人
    2020-12-18 05:26

    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

提交回复
热议问题