<a>
)
The <a>
tag defines a hyperlink, allowing users to
navigate to another webpage, file, or section within the same page.
The href
attribute specifies the destination URL or
anchor point.
Visit our website for more information.
<p>Visit our <a href="https://example.com">website</a> for more information.</p>
The target
attribute of the <a>
tag
specifies where to open the linked resource. Common values include
_blank
(new tab/window), _self
(same tab,
default), _parent
, and _top
.
Open example.com in a new tab.
<p>Open <a href="https://example.com" target="_blank">example.com</a> in a new tab.</p>
The <a>
tag can link to a specific section within
the same page using an anchor point (via id
). The
href
attribute references the id
with a hash
(#
).
Jump to Footer Section.
<p>Jump to <a href="#section-footer">Footer Section</a>.</p>
<!-- Target section -->
<div id="section-footer">
<h3>Footer</h3>
<p>This is the footer section.</p>
</div>
The download
attribute prompts the browser to download
the linked resource instead of navigating to it. The attribute’s value
can specify the downloaded file’s name.
<p><a href="/files/sample.pdf" download="sample-document.pdf">Download PDF</a></p>
The <a>
tag with a mailto:
protocol in
the href
attribute opens the user’s email client to
compose a message to the specified email address.
Contact us at info@example.com.
<p>Contact us at <a href="mailto:info@example.com">info@example.com</a>.</p>
The <a>
tag with a tel:
protocol in
the href
attribute initiates a phone call or opens a
dialer on devices that support telephony.
Call us at +1 (234) 567-890.
<p>Call us at <a href="tel:+1234567890">+1 (234) 567-890</a>.</p>
The title
attribute provides additional information about
the link, displayed as a tooltip when the user hovers over it,
enhancing accessibility and user experience.
Learn more about our services.
<p>Learn more about <a href="https://example.com" title="Visit our homepage">our services</a>.</p>