HTML <base> Tag

❮ Previous Reference Next ❯


  <base href="/html/">
<img src="smiley.png" alt="smiley">



The <base> element located within the head element specifies the base URL to be used for all relative URLs contained within a document.


If the document has no <base> elements, then baseURI defaults to location.href.

Warning: The <base> element must come before other elements with attribute values of URLs, such as <link>'s href attribute.

Usage Notes:

Note 1: If multiple <base> elements are used, only the first href and first target are obeyed — all others are ignored.

Note 2: Open Graph tags do not acknowledge <base>, and should always have full absolute URLs. For example:

<meta property="og:image" content="" />

Version: HTML 2, 3.2, 4, 4.01, 5

Standard Syntax

<base href="URL" target="_blank | _parent | _self | _top">

Browser Support



Attribute Value Description
href URL Hyperlink of the page used to all relative URLs in the page
target _blank
This attribute specifies the target window for a hypertext source link that references frames.

Global Attributes

<base> element also supports the Global Attributes in HTML.

Event Attributes

<base> element also supports the Event Attributes in HTML.

By Default CSS Value(s)


Related Tags:

<body>, <head>, <link>, <meta>, <style> and <title>
❮ Previous Reference Next ❯