In this section, we will learn about target attribute of the HTML <base> element.
What is target Attribute in HTML <base> Tag?
The target attribute of HTML <base> element is used to set the location where links on a page should be opened in.
Basically, HTML <a> element has the same attribute and we can separately set this value for each <a> element on a page. But if all of them use the same target to open the linked documents, then using the target attribute on HTML <base> element would apply the same value to all links on a page.
HTML target Attribute in <base> Tag Syntax:
<base target = “_blank | _self | _parent | _top | framename”>
<base> Tag target Attribute Values
In the table below, you can see the list of values for the target attribute
Name |
Description |
_blank |
Open the links in a new tab or window. |
_self |
Open the links in the window of the current document. |
_parent |
Open the links in the parent frame |
_top |
Open the links in the full body of the window |
framename |
Open the links in the specified iframe. |
Example: using target attribute in HTML <base> tag
See the Pen using target attribute in HTML <base> tag by Omid Dehghan (@odchan1) on CodePen.