The HTML <base> element sets the document base URL used to resolve relative URLs. It belongs inside <head> and is useful only when many relative references should resolve from a location different from the current document URL.
<head>
<base href="https://www.example.com/docs/">
</head>
<body>
<a href="guide.html">Guide</a>
</body>
The link resolves to https://www.example.com/docs/guide.html.
If <base> uses href or target, place it before other head elements whose URL-valued attributes should be resolved using that base.
<base target="_blank"> can set a default browsing context for links, areas and forms without their own target. In most sites it is clearer to set targets only on the specific navigation that needs them.
A fragment such as href="#faq" is also resolved against the base URL. With a different base URL, a link intended to jump within the current page can therefore navigate to the base URL plus that fragment.
When multiple <base> elements are present, browsers use only the first href and first target. Keeping one clear base element avoids confusing URL resolution.
Original base URL demo HTML head Meta tags
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.