Other Linking Options with the Anchor Tag <a> or href Attribute:

The important of this tutorial is to show that the anchor tag (along with the href attribute) is very versatile.  Beside using the <a> tag to create a navigational bar or navbar for short (See Horizontal and Vertical Menus) using CSS, the <a> tag has many other uses to help the userr navigate your web site, other web sites send you an email :

Regular link (Hypertext)

Creating a regular is the hallmark of any web site and the easiest  to create which allows you to navigate from one page to another.

There are three types of links:

 Example: <a href="otherpage.html">Text for link goes here</a>
NOTE: By default, a regular link will use blue text with an underline on it. This can be changed using CSS.
NOTE: To updates a link, change it in the Property Inspector.   If you move or rename a file or folder in the File Panel, Dreamweaver will automatically prompt you to update links or graphics on the page to maintain the correct path.
NOTE: href stands for hypertext reference.

Targeting a Link

There are several options when targeting a link you create:

Link States

There are four major link states color or graphic that can be styled with CSS:

TIP: When using an acronym, it is best practice to use a dotted line instead of a solid line which are usually reserved and understood as links.

Image Link

Image link is basic the same as a text link. The different is that the <a> tags are wrapped around an <img> tag instead of some text.   Remember, because it is a link there will be a blue border around the image link. This border can be surpressed by setting the border thickness to 0 in the Property Inspector or creating a CSS selector to set the image border to zero (i.e., img {border-style:none;} will target all img. .profile img {border-style:none;} will target only images that are inside of a container element with an ID name of profile)

Example: <a href="anotherpage.html"><img src="image.jpg" /></a>

Email Link

An email link is also similar to a text or graphics link.  The different is that the href attribute is set to an email address prefixed by a mailto: protocol instead of a HTML file name (i.e., myfile.html).  And, instead of opening an HTML file, when clicked, an email link will open the user's email program (i.e., Outlook)

Example: <a href="mailto:yourname@yourcompany.com">Email Text goes here</a>

Named Anchor (Bookmark)

When creating a long document page, named anchors (bookmarks) can be "jump" or "auto-scroll"  from links at the top of the page to links at the bottom of the page which eliminates the need for scrolling down the page manually. Conversely, a link can be placed at the bottom of the page and an anchor (normally called "top") can be used to "jump" back up to the top of the page.  Named Anhcors can be used to jump WITHIN the SAME PAGE or at a LOCATION INSIDE another page.

Named anchors require TWO LINKS:

  1. First, create a regular link to or a series of regular links ( A | B | C | D)  usually at the top of the page and prefix them with hash signs without any space in the Property Inspector.
    Example: <a href="#A"> A </a> <a href="#B"> B </a> <a href="#C"> C </a> <a href="#D"> D </a>
    NOTE: Notice that the hrefs are not pointing to HTML files (i.e., myfile.html) but to a named anchor (i.e., #A, #B, #C, etc.)
  2. Then, create named anchor link(s) where the regular link(s) will jump to the named anchors by using the Named Anchor icon on the Insert Object Bar or pressing CLT+ALT+A.  Ensure it has the same ID name as the href names in the regular links at the locations where you want the browser to jump to.
    Example: <a id="A">A info at bottom of page</a>
    NOTE: Name anchors are case-sensitive and must be unique on a page.
    NOTE:  You can also use the Point-To-File technique to link to an anchor.  First, select the link and then use the Point-To-File icon and drag to the anchor on the page. TIP: Move window to anchor location  BEFORE using the Point-To-File icon.
    NOTE: To create a named anchor to another page, you need to provide BOTH the filename and the named anchor (<a href="myfile.html#anchorname">Link text goes here</a>
  3. Preview in a browser.

Image Map

Using an image map is like using an image link but with the ability to have MULTIPLE LINK options to choose from on a SINGLE image.  If you have a SINGLE image with SEVERAL LINK AREAS (HOTSPOTS) that you want to use to take the user to different pages (or other interactivity), you can use an image maps.

NOTE: While an image map does not use the <a> tag (instead it uses the <area> tag) it shares many behaviors of the <a> tag such as its "href" attribute and its ability to link to other sources, it was included in this list.

Jump Menu

A Jump Menu is a combo box and/or button used to allow users to choose an option and then "jump" them to another page automatically or when a button is clicked.

Bonus: Link to a JavaScript Function

While most of the time we think of linking to a page, you can also link to a JavaScript function from within a JavaScript file on the page on an external JavaScript file.

EXERCISE: Other Linking Option Exercise