Detailed answer
The effective base href changes how relative URLs are resolved throughout the document.
This can affect anchors, scripts, images, and stylesheets. Use it only when its document-wide consequences are intended. A fragment-only link may resolve against the base rather than the exact current page URL.
Example
<head><base href="https://example.com/docs/"><title>HTML docs</title></head>
<body><a href="forms.html">Forms</a></body>
Understanding the behavior
A base href changes how relative URLs throughout the document resolve, including links and resource references. Its effects can be broader than expected, and only the first relevant base value is used. An absolute URL is not resolved in the same way.
Practical implementation notes
Inspect a link's resolved href property before and after adding base. If local fragment links unexpectedly leave the page, check the base URL rather than changing every id.
How to check it
Inspect the document baseURI and resolve several relative resources against it.
Expected result
The effective base explains the changed resource destinations.
Watch out: Check the resolved URL rather than relying only on the source string.
Read the reference ↗