基本的HTML - 如何设置当前文件夹的相对路径? [英] Basic HTML - how to set relative path to current folder?

查看:123
本文介绍了基本的HTML - 如何设置当前文件夹的相对路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以说我目前在:
http://example.com/folder/page.html



是否可以在此页面上创建相对链接,指向 http://example.com/folder/ ,而不指定文件夹在任何地方? (仅使用HTML)。

更新:
事实证明 ./ 只能在非严格的doctype模式下使用,而在两种模式下都可以使用,所以在我看来它仍然是更好的答案:)
Thanks everyone。

doctype有所不同,但有时候./也很好。

 < a href =。>链接到此文件夹< / a> 


Lets say I am currently at: http://example.com/folder/page.html

Is it possible to create a relative link on this page that points to http://example.com/folder/ without specifying folder anywhere? (And using only HTML.)

UPDATE: As it turned out ./ works only in non-strict doctype mode, while . works in both modes, so it is still a better answer in my opinion :) Thanks everybody.

解决方案

Just dot is working. The doctype makes a difference however as sometimes the ./ is fine as well.

<a href=".">Link to this folder</a>

这篇关于基本的HTML - 如何设置当前文件夹的相对路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆