In this article, we’ll explore various types of links commonly used in web development. Links are essential for navigating websites, and knowing how to implement different types can greatly enhance the user experience. Let’s look at a few examples.
A basic hyperlink is used to link external or internal pages. Here’s an example of a simple link to a portfolio:
<a href="https://Pirabu.com"> Visit portfolio</a>
If you want to open a link in a new tab or window, add target="_blank"
to the anchor tag. This ensures the user’s current page stays open while the link opens in a new tab.
<a href="https://pirabu.com" target="_blank"> Visit portfolio new tab</a>
To link to other content on the same website, simply use the relative path of the page:
<a href="/contact"> Visit portfolio new tab</a>
You can enable a phone call by clicking a link. This is particularly useful for mobile-friendly websites:
<a href="tel:+33760774934"> Call me</a>
Similarly, an SMS link allows users to send a text message. Here’s the basic format:
<a href="sms:+33760774934"> SMS me</a>
For Android, you can pre-fill the SMS body content:
<a href="sms:+33760774934?body=Hello...">SMS me</a>
For iPhone (iOS), the format is slightly different:
<a href="sms:+33760774934&body=Hello...">SMS me</a>
To send a message via WhatsApp, you can create a link that opens the WhatsApp app with pre-filled text:
<a href="https://wa.me/+33760774934?text=Hello...">WhatsApp me</a>
An email link allows users to send an email directly from a website. You can even pre-fill the subject line and body content:
<a href="mailto:pirabu.chandran@gmail.com?subject=Contact Pirabu&body=Hello...">Mail</a>
Conclusion
These various types of links can make your website more interactive and user-friendly. From basic navigation to making phone calls or sending messages, these techniques are useful for improving user experience.