The Anchor Tag

ken's picture

Opening Tag: <a>
Closing Tag: </a>

Purpose:
The anchor tag is fundamental to website design, as it allows documents to be linked together. Click Here for a beginners guide to linking. Anchors have two purposes; First the define a position on a page where other documents can link to. Second and more importantly, they allow you to create links to other documents.

Attributes:
charset=characterset
- Rarely needed, but allows you to specify the character encoding of the resource pointed to.

href=url
- The href attribute specifies the document that you wish to link to. This can be a url of another webpage, another anchor on the same webpage, or even a "mailto:email@webguruguide.com"

hreflang=language
- Rarely needed, but allows you to specify the language of the resource pointed to.

id=string
- You can create an ID for an anchor allowing dynamic changing of the link - perhaps through a script to highlight the link under certain conditions.

name=string
- When creating an anchor within a document, the name allows that anchor to be picked out. Supposing you name your anchor 'fish', you can link to that position on the webpage by specifying '#fish' at the end of the url within the href attribute.

rel=linktype
- Rarely needed, but describes the relationship between the current document and the resource pointed to.

rev=linktype
- Rarely needed, but describes a reverse link from the target document to the current document.

target=targetwindow
- Specifies where to open the target document. Options include;
"_blank" - A new blank window.
"_self" - Load into the same window.
"_parent" - Load into the parent window.
"_top" - Load at the top of the window.
"name" - Specify the name of a frame to load into.

title=string
- Specifies a title for the link. While this isn't necessary, and isn't supported in all browsers, we highly recommend you include the title tag as it can assist your S.E.O. strategy!

type=contenttype
- Rarely needed, but allows you to specify the type of resource pointer too.

Examples:

<a href="http://www.webguruguide.com">Link to Web Guru Guide</a>
Link to Web Guru Guide

<a href="http://www.webguruguide.com" target="_blank" title="The Web Guru Guide!">Link to Web Guru Guide</a>
Link to Web Guru Guide

The second example opens in a new browser, and adds the title attribute.

Related Tags:

-

Back to:
Alphabetical Guide
Guide By Type