HTML中如何设置超链接相对路径--上级目录与下级目录的写法

  HTML中用../表示源文件所在目录的上一级目录,../../表示源文件所在目录的上上级目录,再上层目录类似。

  若chap1.html在D:php\Tutor\student1\math\chap1.html,student1.html在D:php\Tutor\student1.html,则在chap1.html中访问student1.html这样写:

  <a href = "../../student1.html">student1.html</a>

  

  引用下级目录的文件,直接写下级目录文件的路径即可。

  若student1.html在D:php\Tutor\student1.html,chap1.html在D:php\Tutor\student1\math\chap1.html,则在student1.html中访问chap1.html这样写:

  <a href = "student1/math/chap1.html">chap1.html</a>

posted @ 2017-12-12 23:40  莫道桑榆晚  阅读(5354)  评论(0)    收藏  举报