Search Help:  
 
Enter keywords to search help.

How do I link files in my subdirectory?

To create a link to a file or folder, you need to use an <a href > tag. The basic structure of a link looks like this:

<a href="">Your text</a>

Add your file name to the first part of the tag, and include the words you want to link between the tags. In the example below, we link the sentence "This is my home page" to a file called "index.html."

<a href="index.html">This is my home page.</a>

If you'd like to link to a file located within a subdirectory, just include the subdirectory with the file name. (The series of subdirectories before the file name is called the file's path.) In the example below, we link our sentence to a file on our site called "index.html" that is stored in a subdirectory called "subdirectory1."

<a href="subdirectory1/index.html">This is my home page.</a>

If you'd like to link to a page that's not in your web site directory (in other words, a page outside of your own web site), you will need to include the entire web address of the page. In the example below, we link our sentence to Yahoo!'s home page.

<a href="http://www.yahoo.com/index.html">This is Yahoo!'s home page.</a>

You can link to other kinds of files the same way. For example, you might have uploaded an audio clip to your File Manager. You can link to this clip with an <a> tag. In the example below, clicking the word "Listen" would open the audio file "mysong.mp3."

<a href="mysong.mp3">Listen</a>

Images
Creating a link to an image is just as easy. For this task you need to use an <img> tag. Add your image file name to the tag; then, when you add this link to your page, you will be able to display the image. In the example below, we create a link to the image called "logo.jpg."

<img src="logo.jpg">

You can link an image to a destination the same way you link words. In the example below, we'll link our image to our home page, "index.html." When a visitor clicks on our image, they will go to the home page.

<a href="index.html"><img src="logo.jpg"></a>

Important Notes
Remember that file and subdirectory names are case sensitive; in other words, "subdirectory_1" is not the same as "Subdirectory_1," and "logo.jpg" is not the same as "logo.JPG."

Also, pay close attention to the file extension. In the examples above, our page file names ended with .html. If we had used .htm instead, our links would break.

Find more HTML tips in our list of recommended HTML resources.

Was this article helpful?

Yes   No
Click to contact Customer Care for further assistance.