[路径]相对路径两种绝对路径
![[路径]相对路径两种绝对路径](http://pic.ttrar.cn/nice/%5b%e8%b7%af%e5%be%84%5d%e7%9b%b8%e5%af%b9%e8%b7%af%e5%be%84%e4%b8%a4%e7%a7%8d%e7%bb%9d%e5%af%b9.jpg)
相对路径
<a href="hello">相对路径</a>
它请求的的地址是和当前页面所处的位置有关
例如:
如果这个超链接处在index.html页面里,而index.html的路径是http://localhost:8080/index.html
那么href="hello",所指向的路径为http://localhost:8080/hello
如果这个超链接处在a.html页面里,而a.html的路径是http://localhost:8080/abc/xyz/a.html
那么href="hello",所指向的路径为http://localhost:8080/abc/xyz/hello
即和所处页面并列在同一路径下
http://localhost:8080/index.html
http://localhost:8080/hello
http://localhost:8080/abc/xyz/a.html
http://localhost:8080/abc/xyz/hello
绝对路径1
<a href="/hello">绝对路径1</a>
绝对路径:和页面所处位置无关,/代表工程根路径,/等效http://localhost:8080/
绝对路径2
<a href="http://localhost:8080/hello">绝对路径2</a>
便是把路径写死,这种绝对路径一般用于访问站外资源时使用


