PICS1

Other Elements

Here are the last three elements from HTML 2.0.

Horizontal Rules

The horizontal rule element (<HR>) is used to create a dividing line across the document. A useful method for providing an unmistakable division between topics.

Return


Anchors

The Anchor element(<A>...</A>) is used to provide a fixed position within an HTML document to link from or to. The Anchor has the following attributes:

HREF and NAME are the two most commonly used attributes of the Anchor element.

HREF Attribute

HREF (Hyper Reference) specifies the resource to be requested by the browser when the user activates the link. The resources are identified by either an URL (most common) or an anchor name.

There are two types of URLs used in links. One is called Relative and the other is Absolute. Relative URLs indicate where to find the specified resource in relation to the current document. Absolute URLs tell the browser the exact path from start to finish.

Relative Referenced Link:

<A HREF="../session3/index.html">Start of Session 3</A>
Relative URL Path Map

Absolute Referenced Link:

<A HREF="http://www.w3c.org/pub/WWW/MarkUp/html_spec/L2Pindex.html">
   HTML DTD Reference</A> at the World Web Consortium.
Absolute URL Path Map

NAME Attribute

The NAME attribute is assigned a value which can be used in the HREF attribute of another anchor to link to a different place in the same document. This link goes to the Horizontal Rules section of this document.

The syntax for an internal link is:

<A NAME="horiz">Text at location of anchor or empty element</A>


<A HREF="#horiz">Horizontal Rules</A>

The number sign in front of the name in the HREF attribute tells the browser this is an internal link. If you specify an URL with the anchor name, such as:

HREF="../session3/index.html#vspace"

Then the browser will load the requested document and postion the named anchor at the top of the document window.

Other Anchor Attributes

The remaining attributes (REV, REL, TITLE, URN, and METHODS) are not commonly used and may not be supported by all browsers. In brief, here are their definitions:

REL
relationship to the linked-to document, such as TOC or Glossary
REV
reverse relationship to the linked-to document, such as Index
TITLE
title of the linked-to document

Image Element

The Image Element (<IMG>) is used to display embedded graphic images within the document window. The Image Element has the following attributes:

SRC Attribute

The SRC attribute specifies the URL of where the image is located. This is typically a relative URL to an image stored on the same server as the HTML document, but can also be an absolute URL to another server. The syntax for the SRC attribute is the same as the HREF attribute of an anchor, excluding anchor names.

ALIGN Attribute

The ALIGN attribute specifies the alignment of the image with respect to the text baseline. Possible values are:

ALT Attribute

The ALT attribute specifies text to be used in place of the image. This text is displayed prior to the image loading or if the user has image autoload turned off, and is displayed in some text only browsers.

ISMAP Attribute

The ISMAP attribute has no value, but identifies this image as an image map. Under HTML 2.0 the only type of image available required a CGI script to handle the mapping. More on image maps later.

Here is the syntax of an image element:

<IMG SRC="images/relative_url.gif" ALIGN="MIDDLE"
     ALT="Relative URL Map" ISMAP>

Images As Links

Various images are ideally suited for use as links on a web page. Simply enclose them inside the ANCHOR tag as you would text to be used as a link.

One thing to watch for is the placement of the closing ANCHOR tag ("</A>"). If it is not placed immediately following the IMAGE tag, a small underscore, or tail, appears on the page indicating the trailing where the trailing space is located, as shown below.

Image link code with closing ANCHOR tag immediately following the IMG tag:

<A HREF="../index.html"> <IMG SRC="../../images/arrow_gold.gif" ALT="Back"></A>

Looks like:

Back

And, image link code with closing ANCHOR tag on the next line following the IMG tag:

<A HREF="../index.html">
<IMG SRC="../../images/arrow_gold.gif" ALT="Back">
</A>

Looks like:

Back

Notice that starting the IMG on the next line after the ANCHOR start tag is OK, just the end tag causes the tail to appear!


Home Page | Session 3 Index | Character Formatting | Character Entities


sqCLOUD19 sqCLOUD27