How do we specify the target for where to open the linked document in HTML?


Use the target attribute to specify the target for where to open the linked document in HTML. Here are the values of the target attribute −

Attribute
Description
_blank
Opens the linked page in a new tab.
self
Opens the linked page in the current tab.
parent
Opens the linked page in a parent frame.
top
Opens the linked page in the topmost frame.

Example

You can try to run the following code to implement target attribute −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML target attribute</title>
   </head>
   <body>
      <h2>References</h2>
      <p>Refer the following <a href = "https://www.qries.com/questions.php" target = "_blank">website</a>.<br>
         The above link will open in a new tab.</p>
   </body>
</html>

Updated on: 01-Jun-2020

91 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements