HTML Code :
<!-- Declare the document type as HTML5 -->
<!DOCTYPE html>
<!-- Start the HTML document -->
<html>
<!-- Start the head section containing metadata about the document -->
<head>
<!-- Set the character encoding to UTF-8 -->
<meta charset="utf-8">
<!-- Set the title of the document to "How to open a linked document in a separate browser tab" -->
<title>How to open a linked document in a separate browser tab</title>
<!-- Close the head section -->
</head>
<!-- Start the body section containing the content of the document -->
<body>
<!-- Create a paragraph with a hyperlink that opens in a new browser tab -->
<p><a href="https://w3resource.com" target="_blank">Target HTML5 TUTORIAL</a></p>
<!-- Close the body section -->
</body>
<!-- Close the HTML document -->
</html>
Explanation:
The above HTML code defines a basic HTML5 document with metadata in the head section and a body containing a paragraph with a hyperlink. The hyperlink is configured with the target="_blank" attribute, causing the linked document to open in another browser tab.
Here's a brief explanation of each part of the HTML code:
Live Demo :
See the Pen a_target-answer by w3resource (@w3resource) on CodePen.
View the example in the browser
Supported browser
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4