For small sites of less than a dozen pages, the easiest way to link an HTML page to another resource is to ensure that files are next to each other, i.e. in the same location. In our example, we will assume that you are trying to link from one page to another: creating a link on page1.html
to go to page2.html
. In that case you would write:
<a href="page2.html">Go to Page 2</a>
Note that nothing else is needed for information - the web browser assumes that page2.html
is in the same location as the page it is linked to. If the pages were in different locations we would need to add path information. You should never write local links in absolute format: if your domain name or site structure changes, the link will cease to work.
Photograph by Minoru Nitta, used under a Creative Commons Attribution Generic 2.0 license
Enjoy this piece? I invite you to follow me at twitter.com/dudleystorey to learn more.