tadam logo

HTML <base> Tag

Example

Specify a default URL and a default target for all links on a page:
<head>
<base href="http://Xhtml.co.il/images/" />
<base target="_blank" />
</head>
<body>
<img src="nord1.gif" />
<a href="http://Xhtml.co.il">Xhtml.co.il</a>
</body>
The output of the code above will be:

Definition and Usage

The <base> tag specifies a default address or a default target for all links on a page.

The <base> tag goes inside the head element.

Browser Support

The <base> tag is supported in all major browsers.

Differences Between HTML and XHTML

In HTML the <base> tag has no end tag.

In XHTML the <base> tag must be properly closed.

Attributes

DTD indicates in which HTML 4.01/XHTML 1.0 DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
AttributeValueDescriptionDTD
hrefURLSpecifies a base URL for all relative URLs on a pageSTF
target_blank
_parent
_self
_top
framename
Specifies where to open all the links on a pageTF

Event Attributes

The <base> tag does not support any event attributes.

More information about Event Attributes.

Standard Attributes

The <base> tag does not support any standard attributes.

More information about Standard Attributes.
Was this information helpful?
   

Comments