Target Attribute

Overview

The target attribute indicates how to open the document linked. It can be opened in the same window, same or a specific frame.

Note: target is an optional attribute. If this option is not set, the links will open in the same window.

Syntax & Example

<a href="example.html" target="_self|_blank|_parent|_top">

For instance, if you are going to open a link in a new tab, the target attribute should read as follows

<a href="example.html" target="_blank">

Attribute Values

Attribute Value Description
_self Opens the linked document in the same frame as it was clicked. If the attribute is not set, this is the default browser option.
_blank Opens link in a new window or tab.
_parent Opens link in the parent frame.
_top Opens link in the full body of the window.
A note to our visitors

This website has updated its privacy policy in compliance with changes to European Union data protection law, for all members globally. We’ve also updated our Privacy Policy to give you more information about your rights and responsibilities with respect to your privacy and personal information. Please read this to review the updates about which cookies we use and what information we collect on our site. By continuing to use this site, you are agreeing to our updated privacy policy.