HTML Base Element

The HTML base element defines the way relative hyper links are handled in the body of the document. The HTML base element has no ending tag. The HTML base element supports the TARGET attribute in frame and transitional document type definitions.

HTML Base Element Requirements

Only one BASE element may exist in the header and the base element is not required to exist in the header. The HTML base element must occur before any other elements with partial URIs if the base element exists in the header.

HTML Base element Attributes

  • Href - Specifies the URI base reference of all relative hyper links on the page.
  • Target - Names a HTML frame to put the contents of the relative hyper link into. If a frame name exists with a custom name, that name may be used instead. Reserved frame names include:
    • _blank - The contents are put into a new unnamed window.
    • _self - The contents are put into the frame the link was in.
    • _parent - The contents are put into the parent of the frame the link was in.
    • _top - The contents are put into the top unframed window.

HTML Base Element Example

An example of the use of the HTML base element is:

<base href="http://www.comptechdoc.org/">

This tag allows you to set a base link location to another website or folder. Without this tag, if there were a relative link to "linux/index.html" on a website such as http://www.yoursite.com this page, the user's web browser would look for the file in "http://www.yoursite.com/linux/index.html". If the base element was set as shown above, the user's web browser would look for the file at http://www.comptechdoc.org/linux/index.html