Links

Links make use of the attributes we can add to elements. A link uses a as its tag, and adds an attribute named href with its value being the address to which the link refers. Between the opening and closing tag will be the content that will be the clickable link. For example a link to Google might be written as :

<a href="http://www.google.co.uk">Google</a>

Links that go to another website must usually have the full address including the protocol (e.g. http:)

If we are linking to the a file in the same folder as the page we are on, then we only need to specify the name of the file, as shown below

<a href="page2.html">Page 2</a>
A file named index.html and a fodler named Courses

If we need to link to a file in a folder, using the folder structure on the right and we wanted to add a link within the index.html file to a page called maths.html in the courses folder, we would create a link as shown below:

<a href="Courses/Maths.html">Maths Course</a>

Conversely, if we were creating a link in the maths.html file in the courses folder, to link back to the index.html file, we would need to create a link that looks 'up' a folder level. We can do this by using ../ insetad of a folder name, for example:

<a href="../Index.html">Course List</a>

This process can be repeated to navigate up a number of folders:

<a href="../../Departments.html">Departments</a>