<a href="folder1/index.html">Home Page</a>
I used this instruction in my code to link another code in another folder but when I test and press Home Page it doesn't work !
<a href="folder1/index.html">Home Page</a>
I used this instruction in my code to link another code in another folder but when I test and press Home Page it doesn't work !
Make sure your folder's name true or file path is true, if all of them is true try Home Page
Your code is: <a href="folder1/index.html">Home Page</a>
;
Lets understand what it does. This code must be in some file. Lets say you are double-clicking a file myFile.html
and this code is written inside it.
Now, this line says that at the very same location you have got a folder named - folder1
and inside it, there lies a file index.html
. So, the structure would be like.
Now, if the path is correct
, your file will open. There is nothing wrong in the code you have written.
You got 2 folders, each have got 1 files
Now, for your issue, first you need to go 1-space up and then go to the other folder. To go 1-place-up we use ../
instruction.
So, for you the answer would be:
<a href="../folder1/index.html">Home Page</a>
based on the comments this is the folder structure you are using:
-myFolder
--folder1 (contains index.html)
--folder2 (contains the code you wrote)
to link from folder2 to folder1 you need to use ../
like this:
<a href="../folder1/index.html">Home Page</a>
With your structure looking as this:
myFolder
|
|----------folder1
|
|-----------> index.html
|
|----------folder2
|
|-----------> another_file.html
To link index.html
from another_file.html
, you need to carefully note the path from folder2
to folder1
. You will need to do this in another_file.html
to create that link:
<a href="../folder1/index.html">Home Page</a>
The ../
allows you to access the folder above your current location, which is folder2