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

Live Demo
<!DOCTYPE html>
<html>

   <head>
      <title>HTML base Tag</title>
      <base href = "https://www.tutorialspoint.com" />
   </head>

   <body>
      HTML: <img src = "/images/html.gif" />
   </body>

</html>

This will produce the following result −

Global Attributes

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

Specific Attributes

The HTML <base> tag also supports the 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

Event Attributes

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

Browser Support

Chrome Firefox IE Opera Safari Android
Yes Yes Yes Yes Yes Yes

html_tags_reference.htm

Advertisements