HTML5 <base> Tag

Example

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

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

<body>
<a href="../../index.html">QcTutorials Tutorial</a>
</body>
Code it Online »

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.

Tips and Notes

Hint: 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


Have Any Suggestion? We Are Waiting To Hear from YOU!

Your Query was successfully sent!