Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <base> href Attribute

An href on a <base> tag defines the base URL for all relative links on a page.

This value affects all relative URLs on the page.

Example

#

A <base> element with an href attribute.
With this setting all relative links on the page 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>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides