HTML <base> Tag

Advertisements


Description

The HTML <base> tag is used to specify a base URI, or URL, for relative links.

For example, you can set the base URL once at the top of your page in header section, then all subsequent relative links will use that URL as a starting point..

Example

<!DOCTYPE html>
<html>
<head>
<title>HTML base Tag</title>
<base href="http://www.tutorialspoint.com" />
</head>
<body>
HTML: <img src="/images/html.gif" />
</body>
</html>

This will produce following result:

HTML:

Global Attributes

This tag supports all the global attributes described in - HTML Attribute Reference

Specific Attributes

The HTML <base> tag also supports following additional attributes:

AttributeValueDescription
href URLSpecifies the URL of a page or the name of the anchor that the link goes to.
target _blank
_parent
_self
_top
Where to open the target URL.
_blank - the target URL will open in a new window.
_self - the target URL will open in the same frame as it was clicked.
_parent - the target URL will open in the parent frameset
_top - the target URL will open in the full body of the window

Event Attributes

This tag supports all the event attributes described in - HTML Events Reference

Browser Support

ChromeFirefoxIEOperaSafariAndroid
YesYesYesYesYesYes

html_tags_reference.htm

Advertisements