Links are fundamental to the web. They allow you to navigate from one page to another and are created using the <a>
tag. With this tag, you can link to other websites, pages on your site, email addresses, and even specific sectiosn within a page.
HTML Links Syntax
Explanation of Syntax:
<a>
: The anchor tag. It wraps the link text, making it clickable.href="URL"
: Thehref
(hypertext reference) attribute points to the URL the link will take the user to. This could be a website, a file path, or even a specific section of the page.
<a href="URL">LINK TEXT</a>
HTML Links Example Code
Explanation of Code:
<a href="https://www.w3schools.com">
: This is an anchor tag pointing to the W3Schools website. When users click “W3Schools,” they are directed to the site.- Link Text (
W3Schools
): The text “W3Schools” is clickable, and clicking it will open the URL specified in thehref
attribute.
<!DOCTYPE html> <html> <head> <title>HTML Links Example</title> </head> <body> <h1>Learn More About HTML</h1> <p>Visit <a href="https://www.techkubo.com">TechKubo</a> for HTML tutorials.</p> </body> </html>