HTML Tags – Base Tag

What is HTML <base> tag ?

HTML <base> tag is used to specify the base URL and/or target URL, for relative links.

HTML <base> tag must have either an href or a target attribute present in it or both.

There can be only one <base> element in a document.

HTML <base> tag must be defined inside the <head> element.

Why HTML <base> tag is used ?

If there is multiple links in the webpage but the base url is same we can use <base> tag.

How HTML <base> tag works ?

We can define the <base> tag URL and other relative links will use the <base> URL as the starting point.

For example, If we set the base URL once in the header section, then all subsequent relative links will use that URL as a starting point.

HTML coding for a website !!!

Click to Learn More about – HTML Tutorial for beginners

Syntax :

<base href="" target="_blank">

Example :

<DOCTYPE html>
<title>Page Title</title>
<base href="" target="_blank">
<p>Learn about <a href="client-side-html">HTML Tutorials</a></p>
<p>Learn about <a href="server-side">Java Tutorials</a></p>

<base> Tag Attributes

HTML <base> tag support following specific attributes.

1hrefurlDefine a base URL link.
Loads the linked document in new window.
Loads the linked document in the parent frame.
Loads the linked document in the same window.
Loads the linked document in the top up on same window.

Browser Compatibility

6Internet ExplorerYes