I am creating a website with simple HTML CSS. How do I create a hyperlink (href) in an HTML file, to an HTML file in a folder, that is not directly related.
See picture. If I want to insert a link in HTML 4 to HTML 3. I know one can use ..\HTML2.html to go back in parent folder, but what is the best way here?
CodePudding user response:
Typing / points to the relative root directory. So you can just do <a href="/html3/html3.html">HTML 3</a>
and it should take you to HTML3.
You can also use <a href="../../html3/html3.html">HTML 3</a>
as you seem to know.
General recommendation would be to pick the closest path. If it's from the root, then select the first. If it's from a relative point from where you are, then the second.
CodePudding user response:
Considering your drawing, I assume that node 1 is the root so the simplest way would be: .\html3.html