HTML links are created using the <a> (anchor) tag. Users can click a link to jump to another page, section, or resource.
<a href="URL">Link Text</a>
target Attribute
By default, when a user clicks an HTML link, the browser loads the linked page in the same window or tab.
The target attribute allows you to control where the linked document opens.
<a href="URL" target="value">Link Text</a>
target Values| Value | Description |
|---|---|
_self |
Default. Opens in the same tab or window. |
_blank |
Opens in a new tab or window. |
_parent |
Opens in the parent frame. |
_top |
Opens in the full window, removing any frames. |
<a href="page.html" target="_self">Open in Same Tab</a>
<a href="https://example.com" target="_blank">Open in New Tab</a>
<a href="parent.html" target="_parent">Open in Parent Frame</a>
<a href="main.html" target="_top">Open in Full Window</a>
<a href="..." target="_blank"> tag.<html> <body> <h2>The target Attribute</h2> <a href="https://aitaurangabad.com" target="_blank">Visit Academy of Information Technology (AIT)</a> <p>If <code>target="_blank"</code>, the link will open in a new browser window or tab.</p> </body> </html>
Visit Academy of Information Technology (AIT)
If target="_blank", the link will open in a new browser window or tab.
href attribute defines the link URL, while target="_blank" forces the page to open in a new tab.
mailto: inside the href attribute.<html> <body> <h2>Link to an Email Address</h2> <p>To contact us at the Academy of Information Technology (AIT), click the email link below:</p> <p><a href="mailto:info@aitaurangabad.com">Send Email to AIT</a></p> </body> </html>
To contact us at the Academy of Information Technology (AIT), click the email link below:
mailto: before an email address opens the user's default mail client when clicked.
<img> inside <a href="..." title="..."> tag.<html> <body> <h2>Image as a Link</h2> <p>Click on the AIT logo below to visit our homepage.</p> <a href="https://aitaurangabad.com" target="_blank" title="Visit AIT Official Website"> <img src="AIT.png" alt="AIT Logo" style="width:120px;"> </a> </body> </html>
<img> element inside an <a> tag makes the picture clickable, and the title attribute displays a helpful hover tooltip.