2

I am trying to link internal files in my HTML code, but for some reason am unable to. I used terminal to get the file path and double checked it was right but am missing something. In the code below the link to index works but not to Marios Page, if someone could guide me to what I'm doing wrong it would be much appreciated.

Code:

<!DOCTYPE html>
<html>
<head>
<title>Laura</title>
</head>
<body>

<h1>Laura's Page</h1>
<p>Hello I am the Laura.html file</p>
<a href="/Users/bobgohary/Desktop/Linking/Index.html">Click me to go to back to Index :() </a>
<a href="/Users/bobgohary/Desktop/Linking/Europe/Italy/Tuscany/Mario.html">Click me to go to back to Mario's Page </a>



</body>
Jack Bashford
  • 43,180
  • 11
  • 50
  • 79
fijilemon12
  • 43
  • 3
  • 11

1 Answers1

2

The problem is that your paths are absolute, but HTML doesn't use absolute file paths. Use a relative path instead.

So let's say for example your index.html file is in the path

/Users/bobgohary/Desktop/index.html

And you have another file here:

/Users/bobgohary/Desktop/Linking/Europe/Italy/Tuscany/Mario.html

You need to figure out how to get to Mario.html from index.html, and here's the solution:

<a href="/Linking/Europe/Italy/Tuscany/Mario.html">

This is the way you should link files in HTML.

Jack Bashford
  • 43,180
  • 11
  • 50
  • 79