HTML base Tag
-
HTML
<base>
tag is define a base URL for all the links with in a web page. -
You have not need to write a full URL in every times. Define once base URL on
<head>
element then after when you need to write, you have to just write relative directory/path URL in a web document. -
Always
<base>
tag is defined on head part of the HTML document. -
HTML
<base>
tag is empty tag.
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML base tag</title>
<base href="http://www.way2tutorial.com/html/" target="_blank"/>
</head>
<body>
<p>Let's get started <a href="index.php">HTML Tutorial</a></p>
</body>
</html>
<base> Tag Attributes
HTML <base> tag support following specific attributes.
Attributes | Value | Description |
---|---|---|
href | url | Define a base URL link. |
target | _blank
_parent _self _top |
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
- Google Chrome
Yes - Mozilla Firefox
Yes - Microsoft Edge
Yes - Opera
Yes - Safari
Yes