相对路径:相对路径意思就是相对于某个文件夹的路径
下面建立两个HTML文档info.html和index.html,用作示例,要求都是在info.html加入index.html超链接。
eg1:相对路径的简单应用
假设:info.html路径是:c:/Inetpub/wwwroot/sites/blabla/info.html
index.html路径是:c:/Inetpub/wwwroot/sites/blabla/index.html
写法:<a href = "index.html">这是超连接</a>
eg2:如何表示上级目录
../表示源文件所在目录的上一级目录,http://www.cnblogs.com/表示源文件所在目录的上上级目录,以此类推。
假设:info.html路径是:c:/Inetpub/wwwroot/sites/blabla/info.html
index.html路径是:c:/Inetpub/wwwroot/sites/index.html
写法:<a href = "../index.html">这是超连接</a>
eg3:如何表示上上级目录
假设:info.html路径是:c:/Inetpub/wwwroot/sites/blabla/info.html
index.html路径是:c:/Inetpub/wwwroot/sites/wowstory/index.html
写法:<a href = "../wowstory/index.html">index.html</a>
eg4:如何表示下级目录
引用下级目录的文件,直接写下级目录文件的路径即可。
假设:info.html路径是:c:/Inetpub/wwwroot/sites/blabla/info.html
index.html路径是:c:/Inetpub/wwwroot/sites/blabla/html/index.html
写法:<a href = "html/index.html">这是超连接</a>
绝对路径:某个文件的完整路径,如:c:/website /img/photo.jpg就是一个绝对路径;
以上部分是摘自网络,自己懒得编写,但是还有个没有搞懂的就是:h5中为什么些类似于c:/website /img/photo.jpg这样的路径是显示不到图片的呢?当我在D盘想要引用C盘的文件时,怎么写路径呢?没有搞清楚……