假设当前访问的页面为:http://example.com/test/index.html
在html中引用外部资源时,所要访问的链接可以写成:
1.绝对路径
以’/‘开头,都是访问当前域名的根目录,即:http://example.com/

则实际路径为:http://example.com/banner1.png
2.相对路径
以’./'或者直接以资源名开头的,都是相对于当前页面路径的上一级,即:http://example.com/test/,


则实际路径为:http://example.com/test/banner1.png
HTML的相对/绝对路径
最新推荐文章于 2025-01-20 22:07:29 发布
2762

被折叠的 条评论
为什么被折叠?



