Description

The <base> tag defines the base URL and a common target to for all relative URLs contained within a document. There must be no more than one <base> tag per document.

The following table summarizes the usages context and the version history of this tag.

Parent:<head>
Content:None. It is an empty element.
Start/ End Tag:Start tag: required, End tag: forbidden
Version:HTML 2, 3.2, 4, 4.01, 5

Syntax

The basic syntax of the <base> tag is given with:

HTML:<base href="URL">; XHTML:<base href="URL" />

The example below shows the <div> tag in action.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Example of HTML base tag</title>
    <base href="https://www.tutorialrepublic.com/">
</head>
<body>
    <p>Learn <a href="css-tutorial/">CSS</a>.</p>   
</body>
</html>                            

The relative URL "css-tutorial/" would resolve to: https://www.tutorialrepublic.com/css-tutorial/

Note: If multiple <base> tags are specified, only the first 'href' and first 'target' attribute's value are used, all others are ignored.

Tag-Specific Attributes

The following table shows the attributes that are specific to the <base> tag.

Global Attributes

Like all other HTML tags, the <base> tag supports the global attributes in HTML5.

Event Attributes

The <base> tag also supports the event attributes in HTML5.

Browser Compatibility

Element
<base>YesYesYesYesYes