Latest

recent

HTML base href Attribute

Definition and Usage

The href attribute specifies the base (default base location) URL for a page.

Syntax

<base href="URL">

Syntax Example

<base href="http://www.1000sourcecodes.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.1000sourcecodes.com/" />
</head>
<body>
<p><a href="default.asp">1000sourcecodes.com</a></p>
</body>
</html>
HTML base href Attribute Reviewed by 1000sourcecodes on 09:06 Rating: 5
Powered by Blogger.