Next / Previous / Contents / TCC Help System / NM Tech homepage

8.3. The base element: Specifying the document's base URI

References to URIs (Universal Resource Identifiers) come in two flavors: absolute and relative. An absolute URI must start with a method name, such as “http:”. A relative URI is one that omits this information and specifies a path relative to the current document. For example, if your page index.html is in the same directory as another page crikey.html, you can use the relative URI reference href="crikey.html".

However, in some situations, some programs need to be able to translate a relative URI reference to an absolute URI. To continue the example above, if the reference to "crikey.html" occurs on a page whose absolute URI is http://crox.edu/index.html, the relative reference would translate to an absolute http://crox.edu/crikey.html.

If you're just throwing together some Web pages, this probably won't affect you. But if at some later point you start using some of the niftier Web software, and you get into trouble with the expansion of relative URLs, recall that you can specify the base URI of the current page with an element of this form:

<base href="baseURI"/>

To continue the example above, to define the proper base URI of page index.html, the head element would contain this element:

<base href="http://crox.edu/index.html"/>