The Base element allows the URL of the document itself to be set, to help browsers in situations where the document may be read out of context. It is especially useful in allowing browsers to determine any partial URL's, or relative paths that may be specified (for example, in
<A HREF> elements, or paths pointing to
<IMG SRC=...> (images). The
<BASE> Element should appear within the bounds of the
Where the base address is not specified, the HTML user agent uses the URL it used to access the document to resolve any relative URLs.
The Base element uses the HREF attribute, which identifies the URL, which should be a fully qualified URL
specifies www.myhost.com to be the base from which all relative URLs should be determined.
The Netscape Navigator (from version 2.0) and Internet Explorer (from version 3.0) adds one other attribute to the
BASE element. With the introduction of targeted windows the TARGET attribute as used in anchors (
<A>) can be used.
This allows the author to pick a default named target window for every link in a document that does not have an explicit
TARGET attribute. Its format is:
CLASS="Style Sheet class name"
CLASS attribute is used to specify the
<BASE> as using a particular style sheet class. See the Style Sheets topic for more information.
ID="Unique element identifier"
ID attribute can be used to either reference a unique style sheet identifier, or to provide a unique name for the
<BASE> element for scripting purposes. Any
<BASE> element with an
ID attribute can be directly manipulated in script by referencing its
ID attribute, rather than working through the All collection to determine the element. See the Scripting introduction topic for more information.
LANG attribute can be used to specify what language the
<BASE> element is using. It accepts any valid ISO standard language abbreviation (for example
"en" for English,
"de" for German etc.) For more details, see the Document Localisation section for more details.
The Internet Explorer 4.0 (and above) specific
TITLE attribute is used for informational purposes. As the
<BASE> element doesn't directly affect the display of a document, no ToolTip is presented when using the
TITLE attribute (as with other elements).
Consistent with Internet Explorer 4.0's Dynamic HTML object model, the
<BASE> element supports various properties and methods. In its role as a document structure element, it supports no events.
Of the Standard Dynamic HTML properties,
<BASE> supports className, document, id, isTextEdit, lang, outerHTML, outerText, parentElement, parentTextEdit, sourceIndex, tagName and title. See the Standard Dynamic HTML properties topic for details.
<BASE> element supports the href and target properties, which directly reflect any settings of their respective attributes (see above).
Of the Standard Dynamic HTML methods,
<BASE> supports contains, getAttribute, removeAttribute and setAttribute. See the Standard Dynamic HTML methods topic for details.
© 1995-1998, Stephen Le Hunte