What is the HTML <base> element?
In <base> tag is used to enumerate the base URL to use for all relative URLs in an HTML document. There can only be a single <base> tag per document, and it should be between <head> tags.
Attributes
The base element supports global attributes in Hypertext markup language but does not support any event attributes. The base tag should possess at least one of the following attributes: href or target.
Attribute | Value | Detail |
href | URL | Base URL for all relative URLs |
target | _blank _top _self _parent | Default target for all hyperlinks |
Syntax
// basic Syntax
<base href="#" target="#">
Code
We only specify a relative address for the image in line 11 and the base address is in line 7. This code represents the basic demo for the base element in HTML.