W3Schools.com

HTML <base> Tag

Example

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

<head>
<base href="http://www.w3schools.com/images/" target="_blank" />
</head>

<body>
<img src="stickman.gif" />
<a href="http://www.w3schools.com">W3Schools</a>
</body>

Try it yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

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


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.


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.

Attribute Value Description DTD
href URL Specifies a base URL for all relative URLs on a page.

Note: The base URL must be an absolute URL!

STF
target _blank
_parent
_self
_top
framename
Specifies the default target for all hyperlinks and forms in the page TF


Standard Attributes

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

More information about Standard Attributes.


Event Attributes

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

More information about Event Attributes.


Related Pages

HTML DOM reference: Base object


WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE