Open In App

How to use the target attribute in the <a> Tag in HTML ?

The target Attribute in the <a> Tag is used to specify where the linked document should be displayed when the user clicks on the hyperlink. It controls the behavior of the link, determining whether the linked content should open in the same browser window, a new browser window, or a new tab. The target attribute accepts different values that define the target location.

Syntax

<a href="https://www.geeksforgeeks.com" target="_blank">
GeeksforGeeks
</a>

Attribute Values

Here are common values for the target attribute:



Example: Implementation of the target attribute in HTML.




<!DOCTYPE html>
<html lang="en">
  
<head>
    <meta charset="UTF-8">
    <meta name="viewport" 
          content="width=device-width, initial-scale=1.0">
    <title>Numbering</title>
</head>
  
<body>
    <a href="https://www.geeksforgeeks.org" 
       target="_blank">GeeksforGeeks
      </a>
</body>
  
</html>

Output:



Article Tags :