content logo

Learn HTML:

Html base tag

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>

Specific Attributes

 

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

 

Attribute Value Description
href URL Specifies 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

 

#

Html base tag Example

#

Html base tag Code

#

Html base tag Tutorial