What is the <a> Element?
The <a> element is used to create hyperlinks in HTML. It requires the href
attribute to specify the link's destination.
Hi, I'm Ahbab. In this article, I'll teach you how to create links in HTML, including internal, external, and anchor links, along with best practices for accessibility.
The <a> element is used to create hyperlinks in HTML. It requires the href
attribute to specify the link's destination.
<a href="about.html">About Us</a>
This example creates a link to another page within the same website.
<a href="https://www.example.com" target="_blank">Visit Example</a>
This example creates a link to an external website and opens it in a new tab using the
target="_blank" attribute.
<a href="#section1">Go to Section 1</a>
<section id="section1">
<h2>Section 1</h2>
<p>This is Section 1.</p>
</section>
This example creates a link that jumps to a specific section within the same page using an ID.
rel="noopener noreferrer" with target="_blank" for security.Which attribute sets the destination URL of a link?