HTML target attribute

target attribute allows the linked document to open in the current or new window.

<a href="https://www.web4college.com">self</a>
<a href="https://www.web4college.com" target="_blank">blank</a>
</>

Attribute values

All possible values of target attribute

target='_self':

Self-based attribute opens the link in the current window. This is the default value.

<a href="https://www.web4college.com" target="_self">HTML</a>
Try</>

target='_blank':

blank based attribute opens the link in new window.

<a href="https://www.web4college.com" target="_blank">web4college</a>
Try</>

target='_top':

top based attribute opens the link in the top frame. If a link is present in multiple nested frames then the link opens in the outermost frame.

<a href="https://www.web4college.com" target="_top">HTML</a>
Try</>

target='_parent':

parent based attribute opens the window in the parent frame. If the link is present in multiple nested frames then the link opens in parent frame.

<a href="http://www.bing.com" target="_parent">Go to bing</a>
Try</>

Related Tags

The tags that support target attribute

<a> tag

a (anchor) tag defines hyperlink. We can make a link to other websites or other web pages.

See the above given examples.

<p>Upload Video: <input type="file" accept="video/*"><p>
Try</>

<base> tag

base tag represents the default or basic URL for all the links present in the document.

<base href="http://www.google.com" target="_blank">


Was this article helpful?