Create Phone Number Links In HTML | Delft Stack

How to Create Phone Number Links in HTML

This article will guide you through calling a phone number from a mobile device using HTML. First, we will create a link in HTML, which calls the number when the link is called.

We can create phone number links in HTML using the anchor a tag used to create hyperlinks. We can specify the phone number in a readable format between the a tag and set it in the href attribute.

We use the tel: keyword followed by the phone number in the href attribute. This syntax creates a link to direct a call to the phone number.

For example, create an a tag and write tel:907-212-7084 in the href attribute. Next, write the same number between the a tag.

When we visit the webpage from mobile devices, a clickable link with the phone number will appear. When the hyperlink is clicked, it will redirect the user to the phone number dial pad with the phone number.

Example Code:

<a href="tel:907-212-7084">907-212-7084</a> Run Above Code

It is better to use the country code before the phone number because the web page’s user may be from a different country.

The example below represents the phone number of the USA.

Example Code:

<a href="tel:+1-907-212-7084">+1-907-212-7084</a> Run Above Code

The - sign between the numbers in the examples above is written for readability. It is not mandatory to write in such a format.

Using the country code is necessary when dialing the phone number from other countries. If you have a local business limited only within your country, you do not need to use the country code on your website.

Từ khóa » Html A Tel Format