HTML Tag Reference - HTML tag <base>








This element establishes a base URL for the website. This allows you to direct every link in the page to a specific site.

<base> is useful in forcing all page links to be opened in a new window by setting the target attribute to _blank. This element is inserted within the <head> element.

Browser compatibility

<base> Yes Yes Yes Yes Yes




What's new in HTML5

None.

Attribute

href
the base URL for all relative URLs in the page
target
Possible value:_blank|_parent|_self|_top|framename. Set the default target for all anchor link and forms in the page.

Global Attributes

The <base> tag supports the Global Attributes in HTML.

Event Attributes

NONE.

Default CSS Settings

NONE.

Example

A demo showing how to use base tag.

<html>
<head>
<base href="http://www.java2s.com/" target="_blank">
</head><!--   www  .j  av a  2  s . c om-->
<body>
     <p>
          <a href="index.htm">Click here</a>.
     </p>
</body>
</html>

Click to view the demo