The A element is one of the key distinctive features of HTML which
defines a link that allows webs of information to be created. The
Bookmark element defines a portion of text and/or an object that serves
as a destination for a URL activation (whether it be by a Hyperlink or
some other method.) The A element can serve as a destination of a URL, an
invocation of a URL, or both at the same time.
Description:
This attribute indicates the URL to be loaded when the hyperlinked
object is activated. Values can be either relative or absolute URLs.
Either this attribute or the NAME attribute MUST be present
in the A tag.
Values:CDATA.
[Either an absolute or relative URL. All URLs should be URL encoded where required.]
Name
[2|3|3.2|4]
[X1|X1.1]
[IE1|M1|N1|O2.1]
Standards Details:
In all HTML 4.x/XHTML 1.0 DTDs (formally deprecated in XHTML 1.0.) Dropped in XHTML 1.1 in favor of ID attribute.
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 element. (Note: HTML 4 states that if
ID and NAME are both used in a given A element, they should have the exact same
value since they share the same domain value space.)
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.)
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
HTML 3.2 and later recommendations.
Values:
The set of applicable names is a function of the protocol scheme of
the URL in the HREF attribute.
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:CDATA.
[A whitespace separated list of relationship names.]
Description:
The REL 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:CDATA.
[A whitespace separated list of relationship names.]
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
HTML 3.2 and later recommendations.
Values: NA
Example
<aname="Bookmark1">This
text is now marked by Bookmark1!</a>
Although these pages list A HREF and A ID/NAME separately in order to
emphasize the distinction in functionality between the two behaviors,
the HREF and ID/NAME attributes can co-exist in the same tag to serve as
both a jump point and a destination for a jump point.
Remember: If an instance of the A element only serves to define a
Bookmark, using a TARGET attribute will have no effect (That is why
the attribute is not listed here.)
The TITLE attribute is listed on this page both under the "Common
Attributes" and "Specific Attributes" categories - I generally consider
TITLE to be a "Common Attribute", but in the special case of the A
and LINK elements, this attribute was included in the HTML standards
as far back as HTML 2.0 - long before these attributes were
specified for any other element.
DTD Note: A reader pointed out to me that it is
also legal to use an A element without an ID/NAME or HREF attribute (eg:
<aTITLE="hello">content</a>) but I don't have any idea why an author
might wish to do this.
HTML 4.x+ recommends that authors use the ID attribute instead of the NAME
attribute wherever possible. ID is the accepted method moving forward and
NAME has been removed as of XHTML 1.1.
Browser Peculiarities
[Test]
When jumping to a bookmark/fragment URL in the last viewable screen/page of
a page that is longer than one screen, Internet Explorer versions up to
and including 3.0 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.
Internet Explorer 4.0 and all Netscape 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 tool tip.
[Test]
Netscape 4.x can not correctly hyperlink to a bookmark (A ID/NAME) that is
nested inside a LAYER element from another document. It succeeds in
jumping to the document, and it does attempt to jump within the
document, but I didn't see a particular pattern to where it was jumping
to...but it isn't the correct location. Hyperlinking to a bookmark
nested in a LAYER from within the same document appears to work correctly.
I list the METHODS, REL, REV and URN attributes as being supported in IE
based only upon Microsoft's documentation. While this data might be
reachable via the DOM, these attributes certainly do not have any default
presentational results.