The base element allows authors to specify the document base URL for the purposes of resolving relative URLs, and the name of the default browsing context for the purposes of following hyperlinks. The element does not represent any content beyond this information. In HTML 5, the base element must be in the head element
Name | Value | Description |
---|---|---|
Attribute's name | Attribute's value | Attribute's description |
href | url | Defines the document base URL |
target | _blank | _self | _parent | _top | string value | Defines the browsing context name |
<base href="http://my.hostname.com/path/"/> <p><a href="page.html">My page</a></p>
<!DOCTYPE html> <html> <head> <base href="http://my.hostname.com/path/"/> </head> <body> <p><a href="page.html">My page</a></p> </body> </html>