HTML <base> Tag

The <base> tag has recently become part of HTML5. It specifies an absolute (base) URL for all relative URLs in the HTML document. The tag also determines how links in the current document should be opened (in a new window, in the current window, etc.).


The <base> tag has no end tag in HTML, but in XHTML it’s required the end tag (</base>) is required.

Oly one <base> tag can be used on the page, and it must be placed in the <head> element. You must insert the tag it as soon as possible, since its action extends from the place where it is specified.


<!DOCTYPE html>
    <title>HTML base tag</title>
    <base href="" target="_blank">
    <a href="/css3-maker/border-radius">Try the instrument CSS Maker</a>

In this example, the <base> tag defines the base URL - "", and the relative link "/css3-maker/border-radius" will use that URL as a starting point.

Copy the above-mentioned code into our editor, and you will see an active link, which, when clicked, opens in a new window. Although the link itself does not contain the target _blank attribute, it will open in a new window, since we have set the target _blank attribute to the absolute URL in the <base> tag.


The <base> tag must necessarily contain either href or target attribute. If necessary, you can use both attributes.

Attribute Value Definition
href URL Specifies the base URL for all relative URLs of the page. The default base address is substituted before all relative addresses on the page.
target _blank -opens the link in a new window.
_self -opens the link in the current window.
_parent - opens the link in the parent frame.
_top - opens the document in the full width of the page.