W3Schools.com

HTML5 <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" alt="Stickman" width="24" height="39" />
<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.

There can be at maximum one <base> element in a document, and it must be inside the <head> element.


Differences Between HTML 4.01 and HTML5

None


Tips and Notes

Tip: Put the <base> tag as the first element in 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.


Attributes

Attribute Value Description
href URL Specifies the base URL for all relative URLs in the page
target _blank
_parent
_self
_top
framename
Specifies the default target for all hyperlinks and forms in the page

Global Attributes and Events

The <base> tag also supports the Global Attributes in HTML5.


Event Attributes

NONE



W3Schools Certification

W3Schools' Online Certification

The perfect solution for professionals who need to balance work, family, and career building.

More than 10 000 certificates already issued!

Get Your Certificate »

The HTML Certificate documents your knowledge of HTML.

The CSS Certificate documents your knowledge of advanced CSS.

The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.

The jQuery Certificate documents your knowledge of jQuery.

The XML Certificate documents your knowledge of XML, XML DOM and XSLT.

The ASP Certificate documents your knowledge of ASP, SQL, and ADO.

The PHP Certificate documents your knowledge of PHP and SQL (MySQL).

WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
Download XML Editor
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
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