Easy Tutorial
❮ Tag Menu Att Style Media ❯

HTML <base> Tag

Example

Specifies the default URL and default target for all links on a page:

<head>
<base href="http://www.tutorialpro.org/images/" target="_blank">
</head>

<body>
<img decoding="async" src="logo.png" width="24" height="39" alt="Stickman">
<a href="http://www.tutorialpro.org">tutorialpro.org</a>
</body>

Browser Support

All major browsers support the <base> tag.


Tag Definition and Usage

The <base> tag specifies the default URL and default target for all relative links on a page.

Only one <base> element can be used in a document. The <base> tag must be inside the <head> element.


Tips and Notes

Tip: Place the <base> tag as the first element in the <head> section so that other elements in the head section can use the information from the <base> element.

Note: If the <base> tag is used, it must have either the href attribute, the target attribute, or both.


Differences Between HTML 4.01 and HTML5

None.


Differences Between HTML and XHTML

In HTML, the <base> tag has no end tag.

In XHTML, the <base> tag must be properly closed.


Attributes

Attribute Value Description
href URL Specifies the base URL for all relative links on the page.
target _blank <br>_parent <br>_self <br>_top <br> framename Specifies where to open all hyperlinks and forms on the page. This attribute can be overridden by the target attribute in each link.

Global Attributes

The <base> tag supports HTML global attributes.


Event Attributes

The <base> tag does not support any event attributes.


Related Articles

HTML DOM Reference: Base Object

❮ Tag Menu Att Style Media ❯