HTML <base> Tag

Description

The <base> HTML element is used to specify a base URI, or URL, for relative links. For example, you can set the base URL once at the top of your page, then all subsequent relative links will use that URL as a starting point.

Properties

Permitted Parents
Any <head> that doesn't contain any other <base> element
Content
None. It is an empty element.
Start/End Tags
Start tag: required, End tag: forbidden

Example

<head>
<base href="https://www.cssportal.com/images/">
<base target="_blank">
</head>

<body>
<img src="arrow.gif">
<a href="https://www.cssportal.com">CSSPortal</a>
</body>

Attributes

Attribute Definition
href

Specifies a base URL for all relative URLs on a page.

target

Specifies the target frame to load the page into.
Possible Values:

  • _blank
  • _parent
  • _self
  • _top

Global Attributes

The <base> tag also supports the Global Attributes in HTML5

Event Attributes

None

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
YesYesYes1YesYes
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
YesYes4YesYesYes