Html里的相对路径和绝对路径
有时候link里的href路径分不清是相对路径还是绝对路径,
不知道路径怎么写,现在总结一下
- 第一种情况
info.html路径是:c:\Inetpub\wwwroot\sites\blabla\info.html
index.html路径是:c:\Inetpub\wwwroot\sites\blabla\index.html
在info.html加入index.html超链接的代码应该这样写:
<a href = "index.html">index.html</a>
- 第二种情况
假设info.html路径是:c:\Inetpub\wwwroot\sites\blabla\info.html
假设index.html路径是:c:\Inetpub\wwwroot\sites\index.html
在info.html加入index.html超链接的代码应该这样写:
<a href = "../index.html">index.html</a>
- 第三种情况
假设info.html路径是:c:\Inetpub\wwwroot\sites\blabla\info.html
假设index.html路径是:c:\Inetpub\wwwroot\index.html
在info.html加入index.html超链接的代码应该这样写:
<a href = "../../index.html">index.html</a>
- 第四种情况
假设info.html路径是:
c:\Inetpub\wwwroot\sites\blabla\info.html
假设index.html路径是:c:\Inetpub\wwwroot\sites\wowstory\index.html
在info.html加入index.html超链接的代码应该这样写:
<a href = "../wowstory/index.html">index.html</a>
- 第五种情况
假设info.html路径是:
c:\Inetpub\wwwroot\sites\blabla\info.html
假设index.html路径是:c:\Inetpub\wwwroot\sites\blabla\html\index.html
在info.html加入index.html超链接的代码应该这样写:
<a href = "html/index.html">index.html</a>
- 第六种情况
假设info.html路径是:
c:\Inetpub\wwwroot\sites\blabla\info.html
假设index.html路径是:c:\Inetpub\wwwroot\sites\blabla\html\tutorials\index.html
在info.html加入index.html超链接的代码应该这样写:
<a href = "html/tutorials/index.html">index.html</a>
HTML绝对路径(absolute path)指带域名的文件的完整路径。
有关软件下载,资源查找可以来看看小编的网站,谢谢
网址:www.miaozan.art