For example, given
<BASE href="http://foo.example.com/index.html">
the IMG element
<IMG SRC="images/bar.gif" ALT="">
refers to image
http://foo.example.com/images/bar.gif
attribute name | possible values | meaning | notes |
---|---|---|---|
HREF | URL | base URL to be used | obligatory; must be absolute |
<BASE HREF="http://www.cs.tut.fi/~jkorpela/HTML3.2/">
This implies that e.g. the link
<A HREF="lists.html">list examples</A>
is equivalent to
<A HREF="http://www.cs.tut.fi/~jkorpela/HTML3.2/lists.html">list examples</A>
Since only one BASE element per document is allowed, you cannot have different base URLs in different parts of an HTML file.
In the absence of a BASE element in a document, the URL of the document itself is the base URL within it. (This is not necessarily the same as the URL used to request the document, since the base URL may be overridden by an HTTP header accompanying the document.)
It is advisable to enclose the URL in quotes, although this is not always mandatory.
Don't forget the slash "/".
Anything that follows the last slash in the URL
in a BASE element
is interpreted as
belonging to the filename part and ignored.
The following is equivalent to the BASE element in the example above:
<BASE HREF="http://www.cs.tut.fi/~jkorpela/HTML3.2/foobar">
whereas the following are equivalent to each other, so the meaning
of the first one is probably not what was intended:
<BASE HREF="http://www.cs.tut.fi/~jkorpela/HTML3.2">
<BASE HREF="http://www.cs.tut.fi/~jkorpela/">