Linking pages with hyperlinks is a key aspect of HTML, as it allows users to navigate between different pages on a website. Hyperlinks are created using the <a>
(anchor) tag, which is used to define the link’s destination and text.
Here’s how to create a hyperlink in HTML, along with an example:
<a href="https://www.example.com">Click here to visit Example.com</a>
In this example, the href
attribute specifies the link’s destination (in this case, https://www.example.com
), while the text between the opening and closing <a>
tags serves as the hyperlink’s visible text (in this case, “Click here to visit Example.com”).
In addition to specifying an absolute URL like the one above, you can also use relative URLs to link to other pages within your own site. For example:
<a href="about.html">About Us</a>
In this example, the href
attribute specifies the relative URL of the about.html
file, which should be located in the same directory as the current page. When the link is clicked, the browser will load the about.html
page.
You can also link to specific sections of a page using anchor tags. For example:
<a href="#section-1">Jump to Section 1</a>
In this example, the href
attribute specifies the ID of the target section (in this case, #section-1
). To make this work, the target section must have an id
attribute that matches the value in the href
attribute of the link.
Finally, you can also use email links to allow users to send you an email directly from your website. For example:
phpCopy code<a href="mailto:info@example.com">Contact Us</a>
In this example, the href
attribute specifies the email address to which the message should be sent (in this case, info@example.com
).
Overall, hyperlinks are an essential part of building a functional and user-friendly website. By using them effectively, you can make it easy for users to navigate between different pages and sections of your site, as well as to contact you with questions or feedback.
Also check WHAT IS GIT ? It’s Easy If You Do It Smart
You can also visite the Git website (https://git-scm.com/)