Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML5 <base> tag


May 03, 2021 HTML5


Table of contents


Specify the default URL and default destination for all links on the page:

<head><base href="//statics.w3cschool.cn/images/w3c/" target="_blank"></head> 
<body>
<img src="logo.png" width="24" height="39" alt="w3cschool">
<a href="logo.png">w3cschool logo</a>
</body>
Try it out . . .

Browser support

HTML5 <base> tag HTML5 <base> tag HTML5 <base> tag HTML5 <base> tag HTML5 <base> tag

All major browsers support the label.


Label definition and instructions for use

The label specifies the default URL or default destination for all relative links on the page.

You can use up to one element in a document. The label must be inside the element.


Tips and comments

Tip: Put the label in the position of the first element in the element so that other elements in the head area can use the information in the element.

Note: If you are using the label, you must have the href property or the target property or both properties.


The difference between HTML 4.01 and HTML5

No.


The difference between HTML and XHTML

In HTML, the label does not have an end label.

In XHTML, the label must be turned off correctly.


Property

Property Value Describe
Href Url Specifies the baseline URL for all relative links on the page.
target _blank
_parent
_self
_top
framename
Specify where all hyperlinks and forms in the page open. The property is overwritten by the target property in each link.


Global properties

The label supports the global properties of HTML.


The event property

The label does not support any event properties.


Related articles

HTML DOM Reference Manual: Base Object