HTML <base> tag represents a base URL for all the relative links within web pages. Advantage of base tag is that you do not need to write a full URLs every time for links for your web pages.
For example, you can define the base URL just once at the top of your web page in header section, then all subsequent relative links will use that URL as a starting point.
Note: base tag has no end tag that’s why it is an empty tag and must have either a “href” or a “target” attribute, or both.
Sample Code
<head>
<title>HTML base Tag with Example</title>
<base href="http://www.webblogsforyou.com/webblogscontent/" target="_blank" />
</head>
<body>
<img src="logo.png" height="100" alt="Webblogsforyou Logo" />
</body>
</html>
Sample Result

My images resides under root/webblogscontent/ directory so I added that path in base tag for general use. So whenever I want to use resources from “webblogscontent” directory, I only need to add resource name. From the above example, you can see that I only added image name without giving full path in src attribute of img tag.
Tag Specific Attributes Support
Following are base tag attributes that are supported by <base> tag.
Attribute | Value | Description |
---|---|---|
href | url | Represents a base URL for all relative links goes to |
target | _blank _parent _self _top |
Represents where to open the linked web page or target URL > the target URL will open in a new window > the target URL will open in the parent frameset > the target URL will open in the same frame or window > the target URL will open in the top on same window |
Standard Attributes Support
HTML <base> tag supports HTML Attributes. You can get more details about available HTML Attributes here.
Event Attributes Support
HTML <base> tag does not support Event Attributes. But you can get more details about available HTML Event Attributes here.