Attribute – A Target Attribute


A Target Attribute

The <a target> attribute specifies where to open the linked document in an <a> (anchor) tag.

Syntax

<a target="_blank|_self|_parent|_top|framname">

Examples:

A target attribute with the value of “_blank” opens the linked document in a new window or tab.

<a href="https://www.Codevarsity.org" target="_blank">Codevarsity</a>

A target attribute with the value of “_self” opens the linked document in the same frame as it was clicked (this is the default and usually does not need to be specified).

<a href="https://www.Codevarsity.org" target="_self">Codevarsity</a>
<a href="https://www.Codevarsity.org">Codevarsity</a>

A target attribute with the value of “_parent” opens the linked document in the parent frame.

<a href="https://www.Codevarsity.org" target="_parent">Codevarsity</a>

A target attribute with the value of “_top” opens the linked document in the full body of the window.

<a href="https://www.Codevarsity.org" target="_top">Codevarsity</a>

A target attribute with the value of “framename” opens the linked document in a specified named frame.

<a href="https://www.Codevarsity.org" target="framename">Codevarsity</a>

More Information:

Target Attribute: w3schools

This article needs improvement. You can help improve this article. You can also write similar articles and help the community.