HTML5 <base> Tag

Example

Specify a default URL and a default target for all links on a page:

<head>
<base href="http://www.w3tutors.com/css/" target="_blank" />
</head>

<body>
<a href="default.php">W3Tutors' CSS Tutorial</a>
</body>

Try it yourself »

Definition and Usage

The <base> tag specifies a default URL, and/or a default target, for all elements with a URL (hyperlinks, images, forms, etc.).

The <base> tag must be inside the head element.


Differences Between HTML 4.01 and HTML5

None


Tips and Notes

Tip: Put the <base> tag as the first element in the head element, so that other elements in the head section uses the information from the <base> element.

Note: Maximum one <base> element in a document.

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


Attributes

Attribute Value Description
href URL Specifies the URL to use as the base URL for links in the page
target _blank
_parent
_self
_top
framename
Specifies where to open all the links on the page.
This attribute can be overridden by using the target attribute in each link

Standard Attributes and Events

NONE