HTML base href Attribute
HTML <base> tag
Definition and Usage
The href attribute specifies the base (default base location) URL for a page.
Syntax
Syntax Example
<base href="http://www.w3schools.com/" />
|
Attribute Values
Value |
Description |
URL |
The web resource/address to use as a base URL for the page. Possible URL values:
- An absolute URL - An URL with full address is required (like href="www.example.com")
|
Browser Support

The attribute is supported in all major browsers.
Tips and Notes
Note: The base element must be in the <head> element.
Note: The base element does not work as intended when using anchor URLs
(like href="#bottom"). It will then reload the page.
Tip: All URLs should be URL encoded when required.
Example
<html>
<head>
<base href="http://www.w3schools.com/" />
</head>
<body>
<p><a href="default.asp">W3Schools.com</a></p>
</body>
</html>
|
Try-It-Yourself Demos
base href
attribute example
Set the base URL of the page.
HTML <base> tag
 |

|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|