Language References
Specifies the base URL to use for all relative URLs in a document. | HTML 2, 3.2, 4, 4.01, 5 |
HTML Syntax
<base
href = url
target = _blank | _parent | _search | _self | _top | window_name
>
All relative links and references to external sources in the document, such as images and style sheets, are resolved from this base URL.
When used, the <base
> tag must appear within the HEAD of the document, before any elements that refer to an external source.
<head>
<base url = ...>
</head>
The BASE element can also specify a base target window in which to display destination documents when the user clicks links in the document ( unless the link itself specifies a target window ).
<head>
<base target = ...>
</head>
When building complex, multi page documents, you might want to specify a base URL for the main document ( master HTML file ). To do this, establish a base URL, then give relative URLs for all referenced documents.
If you change the location of the master document, you must update the <base
> tag to the new base URL. All relative references to URLs will be updated relative to the new location of the base URL.
If a document containing links to other documents in the same directory or a subdirectory does not specify a base URL, the full path to the linked documents will usually be resolved correctly.
However, the browser may sometimes resolve relative links incorrectly unless the document containing the links specifies the BASE element.
NOTE: Only the <base
> start tag must be present. The element has no end tag.
The <base
> element supports the following attributes, in addition to global attributes common to all HTML media elements.
Attribute | Value | Description |
href | URL | Specifies the base URL to use for all relative URLs in the page
|
target | _blank | _parent | _self | _top | window_name | Specifies the target window for all hyperlinks in the page
|
The following example sets the base URL of the document to a reference folder.
<head>
<base href="http://asp.net.ph/">
</head>
<body>
Click here to learn about the <a href="abkd/refs/tags/base.html">base</a> element.
</body>
Browsers will then use the <base
> element to resolve the hyperlink to:
http://asp.net.ph/abkd/refs/tags/base.html.
BASEFONT HEAD