Anchor

Level: 0

A section of text which forms the start and/or destination of a hypertext link is called an "anchor" and is defined by the <a> tag.

<a href="http://www.hal.com">HaL Computer Systems</a>

The most common attributes of the anchor tag are:

href

Optional - Level 0. If the href attribute is present, the anchor is sensitive text: the start of a link. If the reader selects this text, (s)he moves to another document whose network address is defined by the value of the href attribute.

The format of the network address is specified in the URI specification for print readers. With the href attribute, the form href="#identifier" can refer to another anchor in the same document. If the anchor is in another document, the attribute may be a relative name (relative to the document's address or the specified base address).

name

Optional - Level 0. If present, the attribute name allows the anchor to be the destination of a link. The value of the attribute is an identifier for the anchor.

Identifiers are arbitrary strings but must be unique within the HTML document. Another document can then make a reference explicitly to this anchor by putting the identifier after the address, separated by a hash sign.

title

Optional - Level 1. The title element is informational only. If present the title attribute should provide the title of the document whose address is given by the href attribute. This is useful for at least two reason:

  • The browser software may chose to display the title of the document prior to retrieving it, for example as a margin note or on a small box while the mouse is over the anchor, or during document fetch.

  • Some documents -- mainly those which are not marked up text, such as graphics, plain text and also Gopher menus, do not come with a title themselves, and so putting a title in the link is the only way to give them a title. Obviously it leads to duplication of data, and so it is dangerous to assume that the title attribute of the link is a valid and unique title for the destination document.

rel (proposed)

Proposed - Level 1. An attribute rel may give the relationship (s) described by the hypertext link.

rev (proposed)

Proposed - Level 1. The rev attribute is the same as rel, but the semantics of the link type are in the reverse direction.

urn

Optional - Level 1. If present, the urn attribute specifies a uniform resource number (URN) for the document. URNs allow a document to be recognized if duplicate copies are found. This prevents a client implementation from picking up a copy of something it already has.

The format of URNs is under discussion (1993) by various working groups of the Internet Engineering Task Force.

methods

Optional - Level 1. The methods attributes of anchors and links provide information about the functions which the user may perform on an object. These are more accurately given by the HTTP protocol when it is used, but it may, for similar reasons as for the title attribute, be useful to include the information in advance in the link. For example, the browser may chose a different rendering as a function of the methods allowed (for example something which is searchable may get a different icon).

The value of the methods attribute is a comma separated list of HTTP methods supported by the object for public use.

Although all attributes are optional, either name or href is necessary for the anchor to be useful. Example:

See <a href="http://www.hal.com/">HaL</a>'s information for more details.
<a name=indecent>Indecent</a> dress is defined as dress which the community finds offensive. 
The restaurant may refuse service to anyone who is <a href="#indecent">indecently</a> dressed.

See also: link.


Preceding Section: Address
Following Section: Blockquote
Parent Section: Body
Contents of HyperText Markup Language