Tag <base> HTML Reference


Specify a default URL and a default target for all links on a page:

<base href="http://www.google.com/" target="_blank" />

<img src="image.gif" />
<a href="http://www.google.com/">Google</a>

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

1. Definition and Usage

The <base> tag specifies the base URL/target for all relative URLs in a document.

The <base> tag goes inside the <head> element.

2. Tips and Notes

Tip: Put the <base> tag as the first element inside the <head> element, so that other elements in the head section uses the information from the <base> element.

Note: If the <base> tag is present, it must have either an href attribute or a target attribute, or both.

3. Differences Between HTML 4.01 and HTML5


4. Differences Between HTML and XHTML

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

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

5. Attributes

DTD indicates in which HTML 4.01/XHTML 1.0 DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.

hrefURLSpecifies a base URL for all relative URLs on a page.

Note: The base URL must be an absolute URL!

Specifies the default target for all hyperlinks and forms in the pageTF

6. Standard Attributes

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

7. Event Attributes

The <base> tag also supports the Standard Event Attributes in HTML.

Relative articles