HTML target attribute

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

Example

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

target attribute values

The value of target attribute is valid browsing mode name. There are four types of browsing modes.

target='_self':

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

Example

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

Try</>

target='_blank':

blank based attribute opens the link in new window.

Example

<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.

Example

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

Try</>

If there is no top frame, then link opens in the same window.

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.

Example

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

Try</>

If there is no top frame, then link opens in the same window.

Related Tags

The tags which support this attribute are as follows.

<a> tag

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

See the above given examples.

<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?

 

Email:

Message:

Get the newsletter