HOME
MAIN
NEXT
PREV
HTML Hypertext Elements Summary
HOME
MAIN
A Element: Hypertext Anchor
Usage:
<A>...</A>
Can Contain: characters, character highlighting, APPLET, BR, IMG,
BASEFONT, MAP, SCRIPT, INPUT, SELECT, TEXTAREA
Can Be Inside: ADDRESS, BLOCKQUOTE, BODY, CENTER, DIV, FORM,
PRE,
DD, DT, LI, P, TD,
TH, Hn,
CAPTION, character highlighting
Attributes: HREF,
NAME, REL, REV, TARGET, TITLE
A marks a block of the document as a hypertext link. This block can be
text, highlighted text, or an image. More complex elements, such as headings,
cannot be inside an anchor. In particular, note that an anchor element cannot
contain another anchor element. At least one attribute must be either HREF
or NAME.
- Attributes:
- HREF="url" (mandatory if NAME is absent)
Gives the target of a hypertext link, where "url" is the
uniform resource locator referencing the target object.
If the url is an *.html, *.htm, *.xml, *.dtd, etc.. file,
the given *.html, *.htm, *.xml, *.dtd file is displayed on the window.
If the url is a *.gif, *.jpeg, *.jpg, *.xmb, etc.. image file,
the given image is shown on the window.
If the url is a *.au, *.wav, *.mid, *.rmi, etc.. audio file, the
given audio file will be played by the audio player.
If the url is a *.avi, etc.. video stream file, the given video
stream file will be played by the video player.
If the url is any other file type, then a download window will
pop up to allow you to down load the file.
- NAME="string" (mandatory if HREF is
absent) Marks the anchored text as a possible, specific destination of a
hypertext link. The value "string" identifies this destination
and is called a fragment identifier.
- REL="string" (valid with HREF only) REL
attribute values describe the relationship(s) associated with the
hypertext link. The relationship is defined between the two entire
documents and is not just related to the particular link. As an example,
REL could indicate that the linked document is an index for the
current one, or is an annotation to the current one (which a browser
might want to display as a pop-up).
The value for REL is a space-separated list of case-insensitive
relationship values (preferably a collection of name tokens). An example
is:
<A HREF="http://foo.edu/fe.html"
REL="next">next document</A>
This would mean that the document fe.html, at the given URL, is the next
document in some author-defined document sequence. Another example:
<A HREF="http://foo.edu/vers2.html"
REL="supersedes">previous document</A>
The document vers2.html is an earlier version of the document.
Values for the relationships and their semantics are currently being
defined; the current status is summarized at the URL: http://www.sq.com/papers/Relationsip.html.
Most browsers do not understand REL and REV.
- REV="string" (optional) REV is like REL
but with the relationship reversed. For example,
<A HREF="http://foo.edu/vers2.html"
REV="supersedes"> later document </A>
means that the document vers2.html is a later version of the document containing
this link.
- TARGET="string" (Netscape and Internet
Explorer only) Supports
multiple browser windows and multiple frames within a given
browser, each frame or window with its own name. The TARGET
attribute lets a document author direct data to be returned, upon
selecting a hypertext link, to one of these named windows. If a window
of the given name does not exist, the browser will create it. For
example:
<A HREF="/path/file.html"
TARGET="win-2">anchor text</A>
indicates that the retrieved document, upon accessing the anchor, should
be directed to the window name "win-2." If a window or window
frame with this name does not yet exist, the browser will clone a new
copy of the browser, assign the name "win-2" to this new
window, and direct the returned data to it.
In the absent of a TARGET, a document is retrieved to the window from
which the link was accessed, as per standard practice.
TARGETs are most often named frames or panes within a given browser
window. These are created by the FRAMESET and FRAME elements, which
permit multiple, independent document viewing panes within the same
browser window, If a frame is declared via <FRAME SRC="url"
NAME="frame1">, then the author of the form:
<A HREF="/path/file.htnl"
TARGET="frame1">anchor text</A>
will direct the returned document to the designated FRAME.
Several target names are predefined, with useful special meanings.
| Predefined Target Names and Their
Meanings |
| TARGET Value |
Meaning |
| _blank |
Load the referenced data into a new, unnamed window. |
| _self |
Load the referenced data into place of the current
window. |
| _parent |
Load the referenced data into the window containing
(or that contained) the
parent of the current document. If there is no parent
document, default to TARGET="_self" |
| _top |
Load the referenced data into the window containing
(or that contained) the
"top" document. If there is no top document, default to
TARGET="_self" |
| Note: All other names beginning with an
underscore (_) are ignored by the browser. |
- TITLE="string" (optional) (valid only if HREF
is present) Gives a title for the linked resource. Most browsers do not
understand and ignore it.
- Examples:
- Example 1: Anchor with Local NAME
and HREF
- Example 2: Anchor with external
file NAME and HREF
- Example 3: Anchor with fully
qualified URL HREF
- Example 4: Anchor to set up download a file
- Example 5: Anchor to set up download a file by clicking an image
- Example 6: Anchor to show an image
- Example 7: Anchor to play an
audio
- Example 8: Anchor to play a video
- Example 9: Anchor with TARGET="_blank"
to load the referenced data into a new, unnamed window
TOP
- Example 1: Anchor with Local NAME and HREF
<P>Mark here as <A
NAME=Anchor_Name_1>Anchor
Name 1</A></P>
<BR><BR><BR>
<P>Click <A
HREF="#Anchor_Name_1">here</A>
to go to the marked "Anchor Name 1"</P>
Mark here as Anchor Name 1
Click here to go to the marked "Anchor Name 1"
TOP
- Example 2: Anchor with external file NAME and HREF
<P>We have the main
HTML Summary file name as HtmlSummary.htm. Click <A
HREF="HtmlSummary.htm#main">here</A>
to access that file.</P>
We have the main HTML Summary file name as HtmlSummary.htm. Click here
to access that file.
TOP
- Example 3: Anchor with fully qualified URL HREF
<P>Click <A
HREF="http://www.yahoo.com/">here</A>
to go to http://www.yahoo.com/.</P>
Click here to go to http://www.yahoo.com/.
TOP
- Example 4: Anchor to set up download a file
<P>Click <A
HREF="HtmlSummary.zip">here</A>
to download "HtmlSummary.zip".</P>
Click here to download "HtmlSummary.zip".
TOP
- Example 5: Anchor to set up download a file by clicking an image
<P>Click this image <A
HREF="HtmlSummary.zip">
<IMG SRC="jpg/GoldPetals.jpg"
WIDTH="50"
HEIGHT="50"
ALT="[GoldPetals.jpg]"></A>
to download "HtmlSummary.zip".</P>
Click this image
to download "HtmlSummary.zip".
TOP
- Example 6: Anchor to show an image
<P>Click <A
HREF="jpg/GoldPetals.jpg">here</A>
to see the image "jpg/GoldPetals.jpg".</P>
Click here to see the image "jpg/GoldPetals.jpg".
TOP
- Example 7: Anchor to play an audio
<P>Click <A
HREF="sounds/MozartNo40.mid">MOZART</A>
to hear "sounds/MozartNo40.mid".</P>
Click MOZART to hear "sounds/MozartNo40.mid".
TOP
- Example 8: Anchor to play a video
<P>Click <a
href="video/CAPTURE.AVI">here</a>
to play a video
"video/CAPTURE.AVI"</P>
Click here to play a video
"video/CAPTURE.AVI"
TOP
- Example 9: Anchor with TARGET="_blank"
to load the referenced data into a new, unnamed window
<P>Click <A
HREF="Hypertext.htm"
TARGET="_blank">here</A>
to load play
"Hypertext.htm" into a new, unnamed window.</P>
Click here to load play
"Hypertext.htm" into a new, unnamed window.
HOME
MAIN