1. Home
  2. Computing & Technology
  3. Web Design / HTML

Adding Links to Web Pages
Links or Anchors on Web Pages

By , About.com Guide

Links and images are the most popular things on Web pages. They are easy to add (just two basic HTML tags) and they bring excitement to your plain text pages. Here you can learn about the a (anchor) tag.

Adding Links

A link is called an anchor in HTML, and so the tag to represent it is the <a> tag. When you use an anchor, you must point to the Web page address that you want to go to when you click. You specify this with the href attribute.

Usage:

<a href="URL of the Web page to go to">Text that will be the link</a>

Some Things to Remember When Adding Links

  • The final </a> tag is required.
  • You can link either images or text
  • Make sure to check your links so that they don't go bad

Internal Links

Internal links are links to another part of the same page. If you clicked on the "Internal Links" link at the top of this page, you would have clicked an internal link (sometimes confusingly called a bookmark).

There are two parts of an internal link:

  • the named portion of the page
  • the link itself

To name a portion of a page, surround some text (or an image or other object) with <a></a> tags. And give that anchor a name. For example:

<a name="internal">Internal Links</a>

While you don't have to surround anything with the <a name> tags, it is a good idea. Some browsers can get confused if they think they have to link to "nothing". Also, keep your name anchors out of tables, if possible. This also can confuse browsers.

Once you have named a portion of your page, link to it using a standard <a href=""> tag. Only, in the href portion, point to the name with a pound-sign (#) at the front. For example:

<a href="#internal">go to internal links</a>
This would link to a section of your page labeled:
<a name="internal"></a>

Previous Articles

Explore Web Design / HTML
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. About.com Web Design A to Z
  5. Web Design Articles A-H
  6. Web Design/HTML Articles A
  7. Adding Links to Web Pages>

©2009 About.com, a part of The New York Times Company.

All rights reserved.