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 - Opens the link in a new window
•_parent - Opens the link in the parent frame
•_self - Opens the link in the same frame as it was clicked
•_top - Breaks all frames, and then opens the target URL

_blank
_parent
_self
_top

Transitional and Frameset

Common attributes for the base tag

none

Javascript Event attributes for the base tag

none


Comments