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

HTMLWeb DevelopmentFront End Technology

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>
raja
Published on 14-Mar-2018 15:49:45
Advertisements