HTML <base> Tag

<!DOCTYPE html>
<base href="">
<p><a href="tags/">HTML Tags</a></p>

Normally the above link would go to "tags/" of the current website (i.e. But now that we've used the "base" element to specify a base URL of "", the link will actually resolve to

How to Use the above Code

  1. Replace the value of the href attribute to be the base URL that will be used for all relative links.
  2. Replace the the rest of the code with your own code.

About the <base> Element

The <base> element allows you to set a "base" URL for all relative links. Therefore, relative links will use the URL specified in the href attribute of the <base> tag.

The <base> element doesn't affect absolute URLs (i.e. those that include the full path).