HTML <base> tag
When writing in HTML, the <base> tag is used to designate the base URL for every relative URL inside of a document. This tag may only be used once, and it must be contained within the <head> of the page. The following sections contain information about this tag, including an example of it in use, as well as related attributes and browser compatibility.
<img src="/jargon/h/chguy.gif" width="57" height="120" alt="Hope Guy">
Notice we can load the Computer Hope Guy image using only the relative path because we specified where the absolute path is using the <base> tag in the <head>. In other words, the current URL is: https://www.computerhope.com/jargon/h/html-base-tag.htm. Normally, the browser would try to load "chguy.gif" from the https://www.computerhope.com/jargon/h/ directory because it's the same directory as the "html-base-tag.htm" file. However, because the base tag devices the base as https://www.computerhope.com/ it will load "chguy.gif" as https://www.computerhope.com/chguy.gif.
Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair; all tags support standard attributes. The following table shows all of the current unique HTML attributes for the <base> tag, as well as a description of each.
|href||Designates the URL of the web page to which the link points|
|target||Designates the target for all of the hyperlinks in a page|
|All versions||All versions||All version||All versions||All versions|