Junior — Middle
What is the main function of the <a> tag in HTML and what is it used for?
sobes.tech AI
Answer from AI
The <a> tag in HTML is used to create hyperlinks. Its main function is to link the current page to another page, document, email address, or resource. When clicking such an element, the browser navigates to the specified address.
Example usage:
<a href="https://example.com">Go to Example.com</a>
Here, the href attribute specifies the URL the link points to. Additionally, <a> can be used to create anchor links within a page using element IDs.