Affiliate link

HTML tutorial - How to use <a> tag to share links

Anchor link is one of the important tag in HTML, it allows you to guide users to the place they want, interact with users, and have call to action.

Anchor links

<a> for URL

Click the link will navigate browser's current tab to the website url.

<a href="https://learncodenow.dev">Anchor link</a>

<a> for email link

The email link will open the operating system's default email client and fill up the email recipient to "learncodenow.us@gmail.com".

<a href="mailto:learncodenow.us@gmail.com">Email us</a>

Code result

<a> for phone contact

Used in mobile phone's browser, click to call the phone contact number.

<a href="tel:+6598765432">Call us</a>

Code result

Affiliate link

<a> for WhatsApp

Begin a chat in WhatsApp with the phone number in the url.

Replace whatsappphonenumber with the phone number of the person
Replace urlencodedtext with a pre-filled text message to send. (Optional)

<a href="https://wa.me/whatsappphonenumber?text=urlencodedtext">
    <img alt="Chat on WhatsApp" src="https://scontent.fsin14-2.fna.fbcdn.net/v/t39.8562-6/302524815_3448899778679909_2843186333341006023_n.png?_nc_cat=104&ccb=1-7&_nc_sid=6825c5&_nc_ohc=5X9amPP0TvUAX__xejm&_nc_ht=scontent.fsin14-2.fna&oh=00_AfD-cs7SA3AZI8bPd-IZ0UN6y7DPwTZzkMYAyde-ffSSFw&oe=6360964F" />
</a>

Code result

<a> for JavaScript interactions

Call JavaScript code/function by using href javascript:

<a href="javascript:alert('Hello')">JavaScript</a>

Code result

<a> for clickable HTML element/tag

The easiest way to make a tag element clickable, is to embed it in <a> tag.

<a href="javascript:alert('Hello')">JavaScript</a>

Code result

Advertisment
WP Engine
Fiverr
Get Surfshark VPN
rocket.net