HTML base tag

HTML <base> tag specifies the alternate or default URL (address) for all the hyperlinks present in a page. This default URL is written in the href attribute of the <base> element.

<head>
 <base href="https://www.web4college.com" target="_blank">
</head>
<body>
 <a href="">Go to web4college</a>
</body>
</>

Tag omission

The base is self-closing element (</base>) i.e. there is no end tag.

Global Attributes

All global attributes are applicable on the base element.

Tag Attributes

Attributes that are applicable to <base> tag
href

This attribute contains the address or URL of the other pages.

<a href="address of external resource/URL">anchor text</a>

If there are more than one base elements then all the base elements are ignored except the first one.

If there are more than elements with different target attributes then all are ignored except first one.



Was this article helpful?