The A element is one of the key distinctive features of HTML. It
defines a link between resources that allows webs of information to be
created. The Hyperlink element indicates a portion of text and/or an
object that serves as a hot area for the user to activate to jump to another
location. The A element can serve as a destination of a URL, an invocation
of a URL, or both at the same time.
To invoke a Bookmark either in a current document or in a remote
document, the Bookmark NAME must be prefaced by a hash mark symbol
("#") [See examples below.] If no Bookmark is specified in the
HREF statement, the browser will default to the top of the document.
Description:
This is a method of giving access/focus to an active HTML element using
a keyboard character. This is a common GUI paradigm also known
as a "keyboard shortcut" or "keyboard accelerator"
A single character is used as the value of this attribute. In addition,
a platform-dependent key is usually used in combination with the
ACCESSKEY character to access the functionality of the active field.
Values:
A single, case-insensitive alphanumeric character from a browser's
character set.
Charset
2 | 3
| 3.2 | 4
| IE | M
| N | O
Required? No
Description:
This attribute indicates the character encoding of the destination
resource of the hyperlink.
Values:
A recognized RFC 2045 language character set string.
Default is ISO-8859-1.
Coords
2 | 3
| 3.2 | 4
| IE | M
| N | O
Required? No
Description:
This specifies the coordinate values in pixels appropriate to the
accompanying SHAPE attribute to define a region of an image for
hyperlinking. The coordinate system for Client Side Image Maps
originates at the top, left corner of the image and values grow
larger as you move down and to the right.
These are the corresponding SHAPE types and COORDS definition schemes: RECT, RECTANGLE:
COORDS="left,top,right,bottom" CIRC, CIRCLE:
COORDS="center_x,center_y,radius" POLY, POLYGON:
COORDS="x1,y1,x2,y2,...,xn,yn"
[The Polygon values specify the successive coordinates of the polygon
and have no explicit limit on number of vertices, but HTML limits
attribute values to 1024 characters. If the first and last coordinates
of a Polygon reference are not the same, then a final segment is implied
to close it.]
Values: Positive integers given as a
comma separated list of X-Y values
Href
2 | 3
| 3.2 | 4
| IE1 | M1
| N1 | O2.1
Required? No
Description:
This attribute indicates the URL to be loaded when the hyperlinked
object is activated. Either this attribute or the NAME attribute
MUST be present in the A tag.
Values: Either relative or absolute URLs.
Hreflang
2 | 3
| 3.2 | 4
| IE | M
| N | O
Required? No
Description:
This attribute specifies the base language of the resource indicated
in the HREF attribute.
Description:
This attribute should specify methods to be used in accessing the
destination, as a whitespace-separated list of names. For similar
reasons as for the TITLE attribute, it may be useful to include the
information in advance in the link. For example, the browser may
choose a different rendering display (possibly a special icon) for a
destination that is searchable. None of the popular browsers ever
implemented this attribute and it has since disappeared from the
HTML 3.2 recommendation.
Values:
The set of applicable names is a function of the protocol scheme of
the URL in the HREF attribute.
Name
2 | 3
| 3.2 | 4
| IE1 | M1
| N1 | O2.1
Required? No
Description:
This attribute assigns a symbolic name to the enclosed object
(text, image, etc.) in order to use it as a destination in a hyperlink or
other URL call. Either this attribute or the HREF attribute
MUST be present in the A tag.
Values: Alphanumeric characters.
Rel
2 | 3
| 3.2 | 4
| IE | M
| N | O
Required? No
Description:
The REL attribute is not currently used by any of the popular
browsers, but is meant to give the relationship(s) described by the
hyperlink.
Values: A whitespace separated list
of relationship names.
Rev
2 | 3
| 3.2 | 4
| IE | M
| N | O
Required? No
Description:
The REV attribute is not currently used by any of the popular browsers.
It is basically meant to be the same as the REL attribute, but the
semantics of the relationship are in the reverse direction. A link from
A to B with REL="X" expresses the same relationship as a
link from B to A with REV="X". An anchor may have both REL
and REV attributes.
Values: A whitespace separated list
of relationship names.
Shape
2 | 3
| 3.2 | 4
| IE | M
| N | O
Required? No
Description:
The SHAPE attribute defines the type of region to be defined for mapping
in the current AREA tag. The value specified here decides the number of
coordinates to list in the COORDS attribute. If the SHAPE attribute is
absent the shape is assumed to be of type RECT
Values: RECT [DEFAULT] |
RECTANGLE |
CIRC | CIRCLE |
POLY | POLYGON
Tabindex
2 | 3
| 3.2 | 4
| IE4B1 | M
| N | O
Required? No
Description:
"Tabbing" is a method of giving access/focus to an active HTML
element using a standard keyboard sequence. All the active elements in a
document can be cycled through using this sequence (ex: Windows TAB key.)
The order of the active elements in this cycle is usually the order they
occur in the document, but the TABINDEX attribute allows a different order
to be established. The use of this attribute should create the following
tabbing order cycle if the browser supports the attribute:
Active elements using the TABINDEX attribute with positive integers are
navigated first. Low values are navigated first.
Active elements not specifying any TABINDEX attribute
Those elements carrying a DISABLED attribute or using negative TABINDEX
values do not participate in the tabbing cycle.
Values: Positive or negative integers.
Target
2 | 3
| 3.2 | 4
| IE3A1 | M
| N2 | O2.1
Required? No
Description:
This attribute specifies the named frame for the HREF hyperlink to
jump to when activated.
Description:
This attribute suggests a title (advisory only) for the destination
resource. The TITLE attribute may be used for display prior to
accessing the destination resource (such as in a margin note or in a
pop-up box while the mouse is over the hyperlink), or for resources
that do not include titles (like graphics, plain text documents or
Gopher menus.)
Values: An alphanumeric string.
Type
2 | 3
| 3.2 | 4
| IE | M
| N | O
Required? No
Description:
This attribute specifies the MIME type of the resource indicated
in the HREF attribute.
Values: Alphanumeric MIME type
URN
2 | 3
| 3.2 | 4
| IE | M
| N | O
Required? No
Description:
This attribute was originally meant to specify a more persistent
identifier for the NAME value of the hyperlink, but none of the popular
browsers ever implemented this attribute. It has since disappeared from
the HTML 3.2 recommendation.
Values: NA
Example
Hyperlink to a document:
<aHREF="http://www.foo.com/index.html"
TARGET="frame1">
Link text that leads to index.html at www.foo.com
</a>
Hyperlink to a Bookmark in the current document:
<aHREF="#Bookmark1"
TARGET="frame1">
Link text that leads to Bookmark1 in the current document
</a>
Hyperlink to a Bookmark in an external document:
<aHREF="http://www.foo.com/index.html#Bookmark1"
TARGET="frame1">
Link text that leads to Bookmark1 in index.html at www.foo.com
</a>
Remember when creating an ISMap that the IMG element must
have the ISMAP attribute and be inside a hyperlink to the external
map file.
Although these pages lists A HREF and A NAME separately in order to
emphasize the distinction in functionality between these two aspects of
the A element, the HREF and NAME attributes can co-exist in the same tag to
serve as both a jump point and a destination for a jump point.
If you are using frames, be sure all hyperlinks in your sub-documents
have targets which indicate the desired destination frames.
A commonly agreed-upon style issue is to make sure your hyperlink
text is descriptive. It is considered good practice to integrate
hyperlinks as seamlessly as possible into runs of text instead of
using something like the very obvious qualifier: "Click Here"
NOTE: An additional method of invoking JavaScript
exists using the A HREF element combined with Script code in place of
the destination URL. The script code (either inline or externally
referenced) is executed when the user clicks on the hyperlink.
Syntax: [script-engine]:[script-code]
Where [script-engine] is the name of the scripting language used,
and [script-code] is either in-line script code or script code referenced
elsewhere in the document.
Example: (displays an alert message box that
contains the text 'hi there')
<aHREF="JavaScript:alert('hi
there')">Click me to see a message.</a>
Browser Peculiarities
Scenario: A document is longer than one screen of
information. Jump to a bookmark/fragment URL located in the last viewable
screen/page of the document. Result: Internet Explorer 3.0 and below scroll such that
the bookmark is at the top of the page, leaving blank space at the end of the
document. This displays the document in a position that is not possible to
achieve using scrollbar controls. Later Internet Explorer versions and all
Netscape and Opera versions display the document as low as it can normally
be scrolled and no more.
Opera places the title attribute in the browser toolbar area while Internet
Explorer implements it as a hovering tooltip.
A brief history of FONT COLOR and A HREF interaction behavior:
Netscape 2,3:
Coloring Hyperlinks only works if the FONT COLOR is applied INSIDE
the hyperlink, and ONLY if both are INSIDE a table cell.
Internet Explorer 1, 2, 3, Netscape 4.0 Beta 1-3, Opera:
Coloring hyperlinks does not work at all.
Internet Explorer 4.0, Netscape 4.0 Beta 4+:
Coloring hyperlinks works anywhere (not just inside tables) if the
FONT COLOR is applied INSIDE the hyperlink.