|
|
|
To access the contents, click the chapter and section titles.
HTML 4.0 Sourcebook
(Publisher: John Wiley & Sons, Inc.)
Author(s): Ian S. Graham
ISBN: 0471257249
Publication Date: 04/01/98
Hypertext Relationship Elements
These elements define .active hypertext relationships between document content and another resource. There is only one such element in HTML, namely A.
A Element: Hypertext Anchors
Usage:
| <A> ... </A>
|
Can Contain:
| characters, character highlighting, A, APPLET, BR, IFRAME, IMG,OBJECT, BASEFONT, MAP, SCRIPT, BUTTON, INPUT, LABEL, SELECT, TEXTAREA
|
Can Be Inside:
| BLOCKQUOTE, BODY, CENTER, DD, DIV, FIELDSET, FORM, IFRAME, LI, NOFRAMES, NOSCRIPT, OBJECT, TD, TH, ADDRESS, APPLET, CAPTION, DT, Hn, LABEL, LEGEND, P, PRE, character highlighting
|
Attributes:
| CLASS, DIR, ID, LANG, STYLE, TITLE, standard event handlers,
|
| onBlur, onFocus,
|
| ACCESSKEY, CHARSET, COORDS, HREF, HREFLANG, NAME, REL, REV, SHAPE, TABINDEX, TARGET, TITLE, TYPE
|
The A, or anchor, element 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.
A supports the standard generic and event-handler attributes described earlier in this chapter. Note that the event handlers are only partially supported by Internet Explorer 4 and Netscape Navigator 4.
A can take several attributes. At least one must be either HREF or NAMEthese specify the destination of the hypertext link (HREF) or indicate that the marked text can itself be the destination of a hypertext link (NAME). Both can be present, indicating that the anchor is both the beginning of one link and the end of another.
Text within anchors containing HREFs is usually rendered differently than plain text. Often, such text is underlined, boldfaced, or rendered with a different color. Similarly, images within anchors containing HREFs are usually rendered with a special border by default. Some browsers change this rendering once a link has been accessed, to inform the user that the link has been explored. Anchors with only a NAME attribute are usually not rendered in a special way.
Some examples of A elements are given in Figures 6.1 and 6.2, as well as 6.43 and 6.44. The element attributes are:
In HTML 4, an A can play a special role within an OBJECTit can define anchor reference that are linked to specific regions within an image referenced by the OBJECT. The details of this mechanism are discussed in the OBJECT element section, in Chapter 7. The relevant attributes, COORDS andSHAPE, are described in the following.
- ACCESSKEY=c (optional; Internet Explorer 4 only) Specifies a typeable character that can be used to access the hypertext link. For example, different anchor elements could be labeled, using ACCESSKEY, by the letters a, b, and c. If the user then references the letter b on the keyboard (using some defined typing sequence), the browser will explore the link with ACCESSKEY=b. This functionality is supported by Internet Explorer 4the labeled links are accessed by typing ALT-c, where c is the letter assigned to the ACCESSKEY attribute and ALT is the ALT key. This feature is not supported by Netscape Navigator 4.
- CHARSET=string (optional; not currently supported) Specifies the character set used by the document referenced by the value of HREF: This attribute is thus meaningless in the absence of HREF. There is no default value, and in the absence of a specified CHARSET, the browser must determine the character set from the HTTP header or by examining the document content. There are currently no browsers that understand this attribute.
- COORDS=string (optional: mandatory if SHAPE is present and not equal to default; valid only inside OBJECT; not currently supported) Specifies the coordinates associated with the designated SHAPE, measured from the upper left-hand corner of the image. Coordinates can either be integer quantities, in which case they are measurements in pixels from the upper-left hand corner, or percentage values in the range (0%,0%) (the upper left-hand corner) to (100%, 100%) (lower right-hand corner).
- The following table illustrates the appropriate use of coordinates for the different possible SHAPEs
|
SHAPE
| COORDS
|
circle
| x, y, rA circle centered at (x,y) and of radius r.
|
default
| No specified coords. Corresponds to the default behavior upon selecting a point inside the object.
|
rect
| x_top, y_top, x_bot, y_botA rectangle with upper-left hand coordinates (x_top, y_top) and lower right-hand coordinates (x_bot, y_bot).
|
poly
| x1, y1, ... xn, ynA polygon, where the coordinates (x1,y1) .... (xn,yn) are the vertices of the polygon (minimum of three vertices). The polygon is closed by connecting the point (x1,y1) to (xn, yn).
|
|
- 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.
- HREFLANG=lang-code (optional; not currently supported) Specifies the language of the resource specified by the HREF attribute. Language codes are described in Appendix E on the companion Web site. This attribute is not currently supported.
- 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. For example, the element
<A NAME="poison"> Deadly Toadstools </A>
- marks Deadly Toadstools as a possible hypertext target, referenced by the string poison. This string is called a fragment identifier. Within the same document, the location is referenced by the hypertext anchor
<A HREF="#poison">Poisonous non-mushrooms</A>
|