When writing in HTML, the 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 in the
of the page. The following sections contain information about this tag, including an example of it in use, and related attributes and browser compatibility.
Example code#

The above code, rendered in a web browser:
- Example code
- Attributes
- Compatibility
- Related information
Notice we can load the Computer Hope Guy image using only the relative path because we specified the absolute path in the tag in the
. 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 loads “chguy.gif” as
https://www.computerhope.com/chguy.gif.
Attributes#
In 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 tag, and a description of each.
You can add the to the header section of your page to have all links open in a new window or tab.
Compatibility#
Browser, Compatibility, URL, Web design terms
- HTML and web design help and support.