The HTML5 base Tag
The HTML5 <base> tag is particularly the target or the base URL for all the relative URLs in an HTML document. The HTML5 <base> tag is important because it sets the main URL being used as a reference for the document. When the HTML5 <base> tag is used, it defines the base address where the elements in the document will be taken from.
The HTML5 <base> tag has to be utilized as the first element in the HTML5 <head> element. It is essential that the HTML5 <base> tag element be used only once.
The functionality of HTML5 <base> tag is the same whether in HTML4.01 or HTML5.
This is an example of how the HTML5 <base> tag is used:
<head>
<base href="http://www.html5videotutorial.com" target="_blank" />
</head>
The HTML <base> tag is used for one or more attributes. These attributes are added to provide the browser more information on how the tag should appear/behave. These attributes consist of a name and a value separated by an equals (=) sign, with the value surrounded by double quotes.
The attributes that can be used for the HTML5 <base> tag are the following:
Attribute |
Value |
Description |
href |
URL |
Identifies base for relative URLs in the page |
target |
_blank |
Identifies target for all links |