HTML相對路徑相對目錄--上級目錄及下級目錄的寫法
如何表示上級目錄
../表示源文件所在目錄的上一級目錄,../../表示源文件所在目錄的上上級目錄,以此類推。
假設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相對路徑相對目錄--上級目錄及下級目錄的寫法