HTML <base> href Attribute

The href attribute on a <base> tag defines the base URL for all relative links on a page. This setting affects all relative URLs on the page.

Example

#

An href attribute on a <base> tag.
With this setting all relative links on the page will start from https://en.wikipedia.org/wiki/.

<head>
  <base href="https://en.wikipedia.org/wiki/">
</head>

<nav>
  <a href="Vincent_van_Gogh">Vincent Van Gogh</a> <br />
  <a href="Henri_Matisse">Henri Matisse</a> <br />
  <a href="Paul_Cézanne">Paul Cézanne</a>
</nav>

Using href

The href attribute specifies the base URL for all relative URLs on a page.

This attibute affects URLs on <a>, <link>, <img>, <video>, <audio>, and other elements.


Syntax

<base href="URL" />

Values

#

Value Description
URL URL to be used as the prefix of all relative URLs in the page.

Browser support

Here is when href support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <base>
Guides