Target Attribute in HTML

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

Examples of <a target>

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

<a href=”https://www.jj.org” target=”_blank”>JJ</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.jj.org” target=”_self”>JJ</a>

<a href=”https://www.jj.org”>freeCodeCamp</a>

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

<a href=”https://www.jj.org” target=”_parent”>JJ</a>

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

<a href=”https://www.jj.org” target=”_top”>JJ</a>

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

<a href=”https://www.jj.org” target=”framename”>JJ</a>

Leave a comment

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