Encodera

Thanks for reading!

Donate to the site — we work hard for you.

HTML & CSS reference

<base>

Sets the base address and the default target for all links on the page.

Syntax

<base href="https://example.com/" target="_blank">

Attributes

ParameterTypeDescription
hrefURLThe base address for all relative links.
target_blank | _selfOptional. 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

  • <head> — The service part of the page: encoding, tab title, linked styles and scripts.
  • <a> — A link to another page, a file or a place on the page.
  • href — The address an `<a>` link leads to or a `<link>` points at.

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.

Thanks for reading!

Donate to the site — we work hard for you.