Links and file paths
Connect internal pages and external resources by reasoning about paths.
- Difficulty
- beginner
- Time
- 40 minutes
- Last verified
- 9/21/2026
What you will build
Create an About page with two-way navigation and debug missing files without guessing.
Understand the idea first
A link asks where to go from the current file. Relative paths change with location; absolute URLs include a protocol and domain. Draw the file tree first.
Build it step by step
my-learning-page/ ├─ index.html └─ pages/ └─ about.html
<!-- index.html -->
<a href="pages/about.html">About me</a>
<a href="https://developer.mozilla.org/en-US/docs/Web/HTML">HTML reference</a>
<!-- pages/about.html -->
<a href="../index.html">Back to learning page</a>- Create the
pagesfolder andabout.htmlwith a complete document skeleton. - Add the first link to the home page; from the root, enter
pages/. - Add the return link;
..moves up one directory. - Click both directions and watch the location in the address bar.
Read the important lines
hrefis the destination; link text should describe it../is the current directory and../is its parent.- If a new tab is truly needed, combine
_blankwithrel="noopener noreferrer".
URLs and special characters
A URL can contain a protocol, host, path, query, and fragment, as in https://example.com/search?q=html#result. The fragment jumps to a matching id. In HTML text, write < when you need a visible less-than sign and & for a standalone ampersand so the browser does not interpret them as markup or a character reference.
Common mistakes and what to check
| Symptom | What to check |
|---|---|
| Using pages/about.html from inside pages | That asks for pages/pages/about.html. |
| Works locally but breaks online | Check filename capitalization. |
| Every link says More | Describe the destination in the text. |
Practice without copying
Create notes/week-1.html. Link to it from home, then link from it to home and About.
Check the answer after you try
Use ../index.html for home and ../pages/about.html for About.
Completion check
- My page contains the required new content
- I can explain the key tags or attributes without the answer
- I deliberately created and fixed at least one error