<base>
Sets the base address and the default target for all links on the page.
Syntax
<base href="https://example.com/" target="_blank">Attributes
| Parameter | Type | Description |
|---|---|---|
| href | URL | The base address for all relative links. |
| target | _blank | _self | Optional. Where links open by default. |
Examples
All relative links are resolved against the base address:
<base href="https://example.com/docs/" target="_blank">
<p><a href="intro.html">Introduction</a> leads to https://example.com/docs/intro.html</p>
<p><a href="#top">Even this anchor</a> now points to the base address.</p>Notes
A page may have only one <base>, and it must come in <head> before any links. It affects every relative address — images, stylesheets, anchor links like #top — so it is used rarely and carefully.
See also
In the tutorial
- Meta tags and SEO — What goes into head — title, meta description, viewport, Open Graph for social networks, the site icon, canonical and robots.