Linking and Navigation > Creating links

 

Creating links

The HTML tag for creating a hypertext link is called an anchor tag or an a tag. Dreamweaver creates an anchor tag for objects, text, or images you create links from. You can create links to other documents and files, and links to specific places in a single document using the a href tag.

For example, if you selected the text Home Page in the Document window, then created a link to a file named home.htm, the HTML source code for the link would look like this:

<a href="home.htm">Home Page</a>

If you are creating a link to a specific place in a document, you first create a named anchor, for example, a name="MainMenu". Then you create a link within the page that refers back to that named anchor, for example, a href="#MainMenu".

Before creating links, be sure you understand how document-relative paths, root-relative paths, and absolute paths work. See About document locations and paths.

You can create several types of links in a document:

A link to another document or to a file, such as a graphic, movie, PDF, or sound file. See Linking documents using the Property inspector and the Point-to-File icon.
A named anchor link, which jumps to a specific location within a document. See Linking to a specific place within a document.
An e-mail link, which creates a new blank e-mail message with the recipient's address already filled in. See Creating an e-mail link.
Null and script links, which enable you to attach behaviors to an object or to create a link that executes JavaScript code. See Creating null and script links.

Using Dreamweaver, there are several ways to easily create local links (between documents in the same site):

Use the site map to view, create, change, or delete links.
In the Document window, use Modify > Make Link to select a file to link to.
Use the Property inspector to link to a file, by using the folder icon to browse to and select a file, using the Point-to-File icon to select a file, or typing the path of the file.
Note: Typing URLs or paths to a file can lead to incorrect paths and links that don't work. To ensure that the path is correct, use the folder icon to browse to your link.
Choose Make Link from the context menu, then select a file to link to.

To create an external link (to a document on another site), you must type the absolute path (with proper protocol) in the Property inspector. Be sure you enter the entire path (including http://) when creating external links.