If you use the wrong file path when referencing a file (such as adding a hyperlink, or inserting a picture, etc.), you can invalidate the reference (you cannot browse the linked file, or you cannot display the inserted picture, and so on).
To avoid these errors, and to refer to the file correctly, we need to learn the HTML path.
HTML has 2 ways of writing: A relative path and an absolute path.
HTML relative path (relative path)
File references for the same directory
If the source file and reference file are in the same directory, write the reference file name directly.
We now build a source file info.html, in info.html to reference index.html file as a hyperlink.
Suppose the info.html path is: c:inetpubwwwrootsitesblablainfo.html
Suppose the index.html path is: c:inetpubwwwrootsitesblablaindex.html
The code that joins the index.html hyperlink in info.html should write this:
<a href = "index.html" >index.html</a>
How to represent a parent directory
.. /indicates the directory in which the source file is located, ... /.. /represents the parent directory on the directory where the source file resides, and so on.
Suppose the info.html path is: c:inetpubwwwrootsitesblablainfo.html
Suppose the index.html path is: c:inetpubwwwrootsitesindex.html
The code that joins the index.html hyperlink in info.html should write this:
<a href = "L" >index.html</a>
Suppose the info.html path is: c:inetpubwwwrootsitesblablainfo.html
Suppose the index.html path is: c:inetpubwwwrootindex.html
The code that joins the index.html hyperlink in info.html should write this:
<a href = "L" >index.html</a>
Suppose the info.html path is: c:inetpubwwwrootsitesblablainfo.html
Suppose the index.html path is: c:inetpubwwwrootsiteswowstoryindex.html
The code that joins the index.html hyperlink in info.html should write this:
<a href = "L" >index.html</a>
How to represent a subordinate directory
A file that refers to a subordinate directory, directly to the path of the subordinate directory file.
Suppose the info.html path is: c:inetpubwwwrootsitesblablainfo.html
Suppose the index.html path is: c:inetpubwwwrootsitesblablahtmlindex.html
The code that joins the index.html hyperlink in info.html should write this:
<a href = "html/index.html" >index.html</a>
Suppose the info.html path is: c:inetpubwwwrootsitesblablainfo.html
Suppose the index.html path is: c:inetpubwwwrootsitesblablahtmltutorialsindex.html
The code that joins the index.html hyperlink in info.html should write this:
<a href = "html/tutorials/index.html" >index.html</a>
HTML absolute Path (absolute path)
HTML absolute Path ( Absolute path refers to the full path of a file with a domain name.
Suppose you register a domain name/html and apply for a virtual host, your hosting provider gives you a directory, such as WWW, which is the root directory of your site.
Assuming that you have a file index.html in the WWW root directory, the absolute path to this file is:.
Suppose you have built a directory called Html_tutorials in the WWW root directory, and then placed a file index.html in the directory, the absolute path of this file is/html_tutorials/index.html.