HTML base tag

<base> tag in HTML

The <base> tag indicates base url/target for all the link in the document.

The <base> tag must be written inside the <head> tag.


href attribute in <base> tag

This attribute is used to give the base url to the whole document.

Example

Try Yourself

target attribute in <base> tag

In the below example target attribute value is not given for <a> tag, but instead it is given in <base> tag, so every link in the web page will have the target attribute value which is given in the <base> tag.

If the target attribute is given in the <a> tag, then the target attribute value will be taken.

Example

Try Yourself