# How to use the <base> tag to define the base URL for an HTML page?

HTMLWeb DevelopmentFront End Technology

The HTML <base> tag is to display the base URL/target for all relative URLs. The tag comes inside the HTML <head>…</head> tag. You can set the base URL once at the top of your page in header section, and all subsequent relative links will use that URL as a starting point.

The following are the attributes of the HTML <base> tag −

Attribute
Value
Description
href
URL
The base URL
target
_blank
_parent
_self
_top
Where to open the target URL:
_blank − the target URL will open in a new window.
_self − the target URL will open in the same frame as it was clicked.
_parent − the target URL will open in the parent frameset
_top − the target URL will open in the full body of the window

## Example

You can try to run the following code to learn about the HTML <base> tag

Live Demo

<!DOCTYPE html>
<html>
</html>