← back to the blog


HTML link phone/mobile number, make it callable

Posted on November 16th, 2019 in Miscellaneous by George

 

The Html anchor tag has the "href" attribute that creates the call link then the phone number is prefixed with text "tel:".

<a href="tel:+44xxxxxxxxx"> 07454XXXXXX </a>

 

The text node between the tags is the visual portion and it can be anything you want it to be including the phone number or text ass 'Call us' or 'Click to call'. 

It should be semantic and descriptive to the action.

 

 

<a href="tel:+44xxxxxxxxx"> Call us today! </a>

Adding country codes is as easy as including "+" along with the country code, before the phone number. In the examples above you may have noticed the GB country code "+44".

 

The other special HTML protocol is "mailto:" which is written in this form.

<a href="mailto:name@mydomain.com"> Click Here To Email Us </a>

 

Mailto takes other parameters like "subject" or "body", for content.

<a href="mailto:someone@example.com?Subject=Hello%20there&body=BodyText" target="_top">Send Mail</a>

 

Thank you!