HTML <base>Tag


Example

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

<head> <base href="http://www.example.com/images/" target="_blank"> </head> <body> <img src="logo.png" width="24" height="39" alt="Stickman"> <a href="http://www.example.com">example.com</a> </body>

Try it Yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

All major browsers support the <base> tag.


Definition and Usage

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

In a document, at most one <base> element can be used. The <base> tag must be located inside the <head> element.


Tips and Notes

Tip:Please place the <base> tag at the <head> element'sfirstelement position, so that other elements in the head area can use the information in the <base> element.

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


Differences Between HTML 4.01 and HTML5

None.


Differences Between HTML and XHTML

In HTML, the <base> tag has no closing 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
_parent
_self
_top
framename
Specifies where all hyperlinks and forms on the page open. This attribute is overridden by the target attribute in each link.


Global Attributes

The <base> tag supportsHTML Global Attributes.。


Event Attributes

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


Related Articles

HTML DOM Reference:Base Object

Other Extensions