Anchor Tag
The <a>
tag, known as the anchor tag, is used to create hyperlinks in HTML. It allows you to link from one page to another or even to specific parts of a page.
The href
attribute specifies the destination URL or file path.
Example: Link to another website
<a href="https://www.example.com">Visit Example</a>
Open in a new tab
<a href="https://www.example.com" target="_blank">Open in new tab</a>
Link to another page in your project
<a href="contact.html">Contact Us</a>
Link to a section in the same page
<a href="#section2">Go to Section 2</a>
And define the section like this:
<h2 id="section2">Section 2</h2>