Search code examples
htmlhyperlinkhref

Html link href attribute <a href="./"> explanation


I just find out that href value can be "./" <a href="./"> As it looks like, target is previous folder > index file

What else could be set for href attribute except protocols (ftp, http, etc, relative path)?

I feel like I've discovered something undiscovered...


Solution

  • Nothing. You either have an absolute URI (which has a scheme) or a relative URI (which does not). In short: It must be a URI.

    Relative URIs can be relative to either the current base URI, the host root or the scheme.

    Using ./ to indicate the current directory has been a staple of relative paths for decades (it predates the WWW).