Base URL
This element is used to define URL to which all URLs on the page are relative to. It can only be used within the head element.
<base
href="url"
target="_blank | frame-name | _parent | _self | _top"**
/>
Key:
‡ = Required attribute
** = Transitional only
Explanation of attributes
href: used to specify the URL to which all URLs are relative to.
target**: used to specify the target window that all links on the page should be opened in. Some of the values for this attribute are special in that they refer to specific frames, such as _blank (a new window), _parent (the parent frame), _self (the frame containing the link), and _top (the full browser window). Other values are used to target frames by the name defined in the frame element.
Event handlers
No event handlers are defined for this element.
Basic example
<base href="http://www.webpageworkshop.co.uk" />
In the above code, the base URL is set to http://www.webpageworkshop.co.uk. This means that any relative links on the page will be relative to this URL, as will the source URLs for any images or other objects.
Compatibility
| Test | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|---|---|---|---|---|---|---|
| Basic element support | |
|
|
|
|
|
| Attribute: href | |
|
|
|
|
|
| Attribute: target | |
|
|
|
|
|
Key:
The browser icons are explained in the below list:
= Microsoft Internet Explorer 6+
= Netscape Communicator 4
= Mozilla and Netscape Navigator 6+
= Opera 7+
= MSN TV (aka. WebTV)
= Konqueror 3.0+