<base href=””> HTML Attribute

Attribute of
<base> HTML Tag
What does <base href=""> HTML Attribute do?
Specifies the base URL which will be used for all relative links in the current document.

Example Code


<head> . . . <base href="http://example.com"> </head> <body> . . . <a href="/page-name">Link text here.</a> <!-- Link address will be http://example.com/page-name -->

Values of the href Attribute

Value Name Notes
url The URL to be used as the base URL for all relative links in the current document.

All Attributes of base Element

Attribute name Values Notes
target _self
_blank
_parent
_top
frame name
Specifies the default target value for all anchor links in the current document.
href url Specifies the base URL which will be used for all relative links in the current document.

Adam is a technical writer who specializes in developer documentation and tutorials.