I am a beginner at HTML I am trying to put one of my projects on to a workspace on CodeAcademy.
I however have multiple html files that I have uploaded.
The intended code should work such that if I press the "whatever" button, it takes me to that page using directory of that file.
I have gotten this to work locally on my personal laptop because I know the directory (ex: C:/user)
Now that I have uploaded it to the CodeAcademy workspace, I do not know hot to get a certain files source.
Any help would be appreciated. (I am assuming only someone who has used CodeAcademy workspace might be familiar with this)
>Solution :
Use relative path instead…
Let’s say your project structure is like this:
pages/about.html
services.html
index.html
In index.html:
<a href="./index.html">Home</a>
<a href="./services.html">Services</a>
<a href="./pages/about.html">About</a>
In services.html:
<a href="./index.html">Home</a>
<a href="./services.html">Services</a>
<a href="./pages/about.html">About</a>
In pages/about.html:
<a href="../index.html">Home</a>
<a href="../services.html">Services</a>
<a href="./about.html">About</a>