View video tutorial

HTML <base> Tag

HTML

The <base> tag specifies base URL.

Base URL


<meta> tag set the base URL for all the relative urls in the page.

A document can have only one <base> tag.

<base> must specify href or target or both.

Element Attributes

Attribute Value Description
href url The base URL used throughout the document for relative URLs.
target _blank
_parent
_self
_top
Specify the default browsing context to show results.

Global attributes

Global attributes may be applied on all elements, although some elements may have no effect on them.

<accesskey>, <class>, <contenteditable>, <contextmenu>, <data-*>, <dir>, <draggable>, <dropzone>, <hidden>, <id>, <lang>, <spellcheck>, <style>, <tabindex>, <title>, <translate>.

Global Event Handler Attributes

This tag does not support any event attributes.

Learning with HTML Editor "Try it Now"

You can edit the HTML code and view the result using online editor.

Example

<head>
    <base href="https://www.w3context.com/html/" target="_blank">
</head>
<body>
    <img src="resources/images/box.png" width="150" height="150" alt="box">
</body>
Try it Now »

Click on the "Try it Now" button to see how it works.


Example

<head>
    <base href="https://www.w3context.com/html/" target="_blank">
</head>
<body>
    <a href="elements/html-base-tag.jsp">HTML base Tag</a>
</body>
Try it Now »

Click on the "Try it Now" button to see how it works.