HTML <base> Tag
The <base> tag is used to make all links start at the root directory or at the specified directory.
Where/how To Use The <base> Tag
| Use in head or body section? | head |
| Inline or Block level tag? | No Level |
| HTML Tag Syntax? | <tag> |
| XHTML Tag Syntax? | <tag /> |
Example
| Code | Output |
|---|---|
| <base href="http://html-tips.net/"> | |
| <base href="http://html-tips.net/html-tags/"> |
Notes
Having <base href="http://html-tips.net/"> would make all links on that page automatically use "http://html-tips.net/" as the base directory
In XHTML this tag must be closed
Whatever you choose for the href attribute, it will be added onto the start of a link or image that is relative (not absolute)
Attributes for the base tag
Attribute | Description | Value(s) | DOCTYPE |
|---|---|---|---|
Strict DOCTYPE Attributes |
|||
href | Destination URL | URL | Strict, Transitional and Frameset |
Non-Strict DOCTYPE Attributes |
|||
target | Where or how to open the link | _blank | Transitional and Frameset |
Common attributes for the base tag
none
Details for Common html Attributes.
Javascript Event attributes for the base tag
none
Details for Javascript Event Attributes.

