Member-only story
HTML for Beginners: Links #7
External link
The <a>
tag is used to create links. The href
attribute specifies the URL the link points to. An external link leads to another web page outside the current website.
The <a> tag is used to create links. The href attribute specifies the URL the link points to. An external link leads to another web page outside the current website.
The <a>
tag with the target
attribute specifies how the link will be opened. The value _blank
opens the link in a new window or tab.
<a href="https://www.example.com" target="_blank">Open Example.com in a new window</a>
Relative link
A relative link uses a relative path to a file on the same website or server. It is useful for creating links between pages on the same site.
<a href="/contact.html">Contact Us</a>
Anchor link
An anchor link leads to a specific part of the same page. It is used for quickly navigating to specific sections of long documents.
<a href="#section1">Go to Section 1</a>
<div style="height: 1000px;"></div> <!-- This div is just to add some space for scrolling -->
<div id="section1">
<h2>Section 1</h2>
<p>This is Section 1 of the document.</p>
</div>
Email link
An email link is a hyperlink that, when clicked, opens the user’s default email client with a new email draft addressed to the specified email address.
<a href="example@example.com">Send an Email</a>