Advertisement
Google Ad Slot: content-top
Links Hyperlinks
In HTML, hyperlinks are created using the <a> (anchor) tag. Hyperlinks are fundamental to the web, allowing users to navigate between different pages, sections of the same page, or even to trigger downloads or open email clients.
Syntax
<a href="url">link</a>
Example 1 : Link to Another Web Page
<a href="https://www.whereisstuff.com">whereisstuff.com</a>
Example 2 : Link to a Section of the Same Page (Anchor Link)
<!DOCTYPE html>
<a href="#section1">Go to Section 1</a>
<div style="height:100vh"></div>
<div>
<h2 id="section1">Section 1</h2>
<p>This is the content of Section 1.</p>
</div>
Example 3 : Link to an Email Address and Download
<!DOCTYPE html>
<a href="mailto:info@example.com">Email Us</a>
<a href="/files/sample.pdf" download>Download PDF</a>
Target Attribute
| Attribute | Description |
|---|---|
| _blank | Opens in a new tab or window. |
| _self | Opens in the same tab or window (default). |
| _parent | Opens in the parent frame. |
| _top | Opens in the full body of the window. |
Example 1 : Target
<!DOCTYPE html>
<a href="https://www.whereisstuff.com" target="_blank" title="site name">Open Example in a New Tab</a>
<a href="https://www.whereisstuff.com" target="_self" title="site name">Opens in the same tab or window (default).</a>
<a href="https://www.whereisstuff.com" target="_parent" title="site name">Opens in the parent frame.</a>
<a href="https://www.whereisstuff.com" target="_top" title="site name">Opens in the full body of the window.</a>
Note
title: Provides additional information about the link, usually displayed as a tooltip when hovering over the link.