HTML base tag

By | March 1, 2020

In this chapter, we will go into detail about a new tag of HTML called <base>. This tag of HTML is used to specify a base URL or URI.Which uses all the links present in the document. With this tag, we can make sure that how to open a link for a problem in a sentence. There is only one <base> inside the HTML document and it is only kept in the head.

Example:-

<!DOCTYPE html>
<head>
	
   <base href="https://learnhtmlcoding.com" target="_blank">

</head>
<body>
	
<h2>HTML base Tag Example</h2>
<p><a href="https://learnhtmlcoding.com/html-base-tag/">HTML base tag</a></p>

</body>
</html>

Browser Support:-

All modern browsers support <base> tag of HTML.

Attributes:-

Attribute Value Description
target _blank
_parent
_self
_top
framename
Specifies the default target for all hyperlinks and forms in the page
href URL Specifies the base URL for all relative URLs in the page

You can see an example:-

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>HTML base tag</title>

    <base href="https://learnhtmlcoding.com" target="_blank">

</head>
<body>
	
<h3>HTML base tag Example:-</h3>

<a href="job-notifications.com/">For Latest Jobs</a><br>
<a href="result-india.in/">All Result</a><br>
<a href="current-gk.com/">All GK question</a><br>

</body>
</html>

Output:-

For Latest Jobs
All Result
All GK question
Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *