<base href=""> HTML Attribute

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
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 NameNotes
urlThe URL to be used as the base URL for all relative links in the current document.

All Attributes of base Element

Attribute nameValuesNotes
target_self
_blank
_parent
_top
frame name
Specifies the default target value for all anchor links in the current document.
hrefurlSpecifies 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.