Basic Structure
HTML <base> Tag
The <base> tag specifies the base URL and/or target for all relative URLs in a document.
Definition and Usage
The <base> tag specifies the base URL and/or target for all relative URLs in a document.
Standard Syntax:
<base>Interactive ExampleRunnable
HTML <base> Example
htmlLive code demonstration for the <base> tag. Click "Try it Yourself" to edit and experiment in real time.
<div style="font-family: system-ui, sans-serif; padding: 16px; background: #ffffff; border-radius: 8px; border: 1px solid #e2e8f0; color: #0f172a;">
<head>
<base href="https://ea-academy.com/" target="_blank">
</head>
<body>
<img src="images/stickman.gif" width="24" height="39" alt="Stickman">
<a href="tags/tag_base.asp">HTML base Tag</a>
</body>
</div>Attributes for <base>
2 Supported Attributes| Attribute | Values | Default | Description |
|---|---|---|---|
| href | URL | none | Specifies the base URL for all relative URLs in the page |
| target | _blank _parent _self _top | none | Specifies the default target for all hyperlinks and forms in the page |
Global Attributes
The <base> tag also supports the standard global attributes in HTML, including class, id, style, title, hidden, and data-*.
Event Attributes
The <base> tag supports event attributes in HTML, such as onclick, onmouseover, onfocus, and more.
Browser Compatibility
ChromeEdgeFirefoxSafariOpera
More Tags in Basic Structure
View All 123Tags →<body>The <body> tag defines the document's body.<!--...-->The comment tag is used to insert comments in the source code. Comments are not displayed in the browsers.<!DOCTYPE>All HTML documents must start with a <!DOCTYPE> declaration.<head>The <head> element is a container for metadata (data about data) and is placed between the <html> tag and the <body> tag.<html>The <html> tag represents the root of an HTML document.<meta>The <meta> tag defines metadata about an HTML document. Metadata is data (information) about data.