<!DOCTYPE html>
<html>
<head>
<base href="https://www.pustudy.com/" target="_blank">
</head>
<body>
<p><a href="html-tags/">HTML Tags</a></p>
</body>
</html>
Normally the above link would go to "tags/" of the current website (i.e. https://pustudy.com/html-tags/). But now that we've used the "base" element to specify a base URL of "https://www.pustudy.com", the link will actually resolve to https://pustudy.com/html-tags/.
target
AttributeThe target
attribute allows you to specify which browsing context to open the links in (eg, a new window, self, top, etc).
Possible values:
U+005F LOW LINE
character.href
attribute to be the base URL that will be used for all relative links.target
attribute (or remove the attribute altogether).<base>
ElementThe <base>
element allows you to set a "base" URL for all relative links. Therefore, relative links will use the URL specified in the href
attribute of the <base>
tag.
The <base>
element doesn't affect absolute URLs (i.e. those that include the full path).