Help - Search - Members - Calendar
Full Version: File Organisation and Links
HTMLHelp Forums > Web Authoring > Web Site Functionality
Elroi
So my whole website is in a file and in this file I have:
CSS file, HTML file, Html document and Css document (for the Html document).
The HTML document using as a menu in my website and the files - HTML, for HTML turtail and CSS, for CSS turtail.
In the HTML file I have more HTML document, and I can't create from one HTML document a link to the menu, the same happen with the HTML document who are in the CSS file.
From the menu to the others it's easy, I just write:
< a href = "HTML/SomeHtmlDocumentName">SomeHtmlDocumentName</a>
But document who are finding in the HTML/CSS file I can't create a link to the menu.
So how i do that?

Thank you everyone!
pandy
That depends on where the document is relative the current document where the link is.

Say you are writing HTML/SomeHtmlDocumentName.html and the full URL is http//example.com/HTML/SomeHtmlDocumentName.html. You want to link to AnotherDocument.html in the same folder.

Using a relative URL it would be simply this.
CODE
<a href="AnotherDocument.html">AnotherDocument</a>


Or you could use root relative URLs if you prefer. Then it would be like this.
CODE
<a href="/HTML/AnotherDocument.html">AnotherDocument</a>


Or the full URL.
CODE
<a href="http//example.com/HTML/AnotherDocument.html">AnotherDocument</a>



If the document you want to link to instead is the index document for your site, http//example.com/index.html, it would be one folder up, right? Folder up is denoted with two dots and a slash if you want to use relative URLs, like this.

CODE
<a href="../AnotherDocument.html">AnotherDocument</a>


You can read all about it here.
http://htmlhelp.com/faq/html/basics.html#relative-url
Elroi
Thank you very much!

I click in the link you add to your reply and I didn't understand it much (because my poor english). I have more one question- what if the document is two folder up?
should I write: "../../MENU.html"?
pandy
Yep! You've got it. happy.gif
CharlesEF
I would recommend you use this format:
CODE
<a href="/HTML/AnotherDocument.html">AnotherDocument</a>
because if you ever move the document the link will still work.

If you use this format:
CODE
<a href="../AnotherDocument.html">AnotherDocument</a>
and you move the document then your link will not work anymore, until you change it.
pandy
On the other hand it won't work locally which is important for beginners so they can create and test everything on their own computer and then upload without rewriting URLs.
CharlesEF
QUOTE(pandy @ Apr 21 2016, 11:21 AM) *

On the other hand it won't work locally which is important for beginners so they can create and test everything on their own computer and then upload without rewriting URLs.

This is true, if a web server is not used. Correct?
pandy
Yup. Even with a server installed I'd say it's easier to just click up any of your documents and everything just works than going over a server. As long as it's all static pages.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.