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.horje.com" target="_blank"> GeeksforGeeks </a> Attribute ValuesHere are common values for the target attribute:
- _blank: Opens the linked document in a new browser window or tab.
- _self: Default behavior. Opens the linked document in the same window or tab.
- _parent: Opens the linked document in the parent frame.
- _top: Opens the linked document in the full body of the window.
Example: Implementation of the target attribute in HTML.
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="/tag"
target="_blank">GeeksforGeeks
</a>
</body>
</html>
Output:
 traget attribute in HTML
|