base: The Document Base URL element
The <base>
HTML element specifies the base URL to use for all relative URLs in a document. There can be only one <base>
element in a document. It is a child of the head
element.
Attributes
Specific attributes
Required attributes
href
is the base URL to be used throughout the document for relative URLs. Absolute and relative URLs are allowed. data: and javascript: URLs are not allowed.
Allowed attributes
target
contains a keyword or author-defined name of the default browsing context to show the results of navigation from a
or form
elements without explicit target attributes. The following keywords have special meanings:
- _self (default): Show the result in the current browsing context.
- _blank: Show the result in a new, unnamed browsing context.
- parent: Show the result in the parent browsing context of the current one, if the current page is inside a frame. If there is no parent, acts the same as self.
- top: Show the result in the topmost browsing context (the browsing context that is an ancestor of the current one and has no parent). If there is no parent, acts the same as self.
Global attributes
accesskey
Specifies a keyboard shortcut to activate or focus an element.
aria-*
Defines accessibility properties and states for assistive technologies.
class
Specifies one or more CSS class names for styling the element.
data-*
Stores custom data private to the page or application.
dir
Sets the text direction (left-to-right, right-to-left, or auto).
hidden
Hides the element from display and assistive technologies.
id
Defines a unique identifier for the element within the document.
inputmode
Hints which virtual keyboard type to display on mobile devices.
itemid
Provides a global identifier for microdata items.
itemprop
Defines a property name-value pair for microdata.
itemref
Associates properties with an item via element IDs for microdata.
itemscope
Creates a new microdata item container.
itemtype
Specifies the vocabulary URL for microdata items (like Schema.org).
lang
Specifies the primary language of the element’s content.
nonce
Provides a cryptographic nonce for Content Security Policy.
role
Defines the element’s semantic role for accessibility.
tabindex
Controls keyboard navigation order and focusability.
title
Provides advisory information displayed as a tooltip.
Example
<base target="_top" href="https://example.com/" />