Wednesday, April 4, 2012

How to Link an Email Address to Text Using HTML code

When you want to leave your email address on a website, but you don’t want to post your email directly onto the site, you can link your email address with some text. For instance, you can say: “contact me by email” and then add your email as a link to the text. When someone clicks on the link, his email program will pop up and your email will be inserted into the address line.

How to link an email address to text using HTML code

What you need for this purpose is to use <a></a> element and the href attribute.

Let me give you an example.

Here is the HTML code:
<a href=”mailto:yourname@yoursite.com”>contact by email</a>

And here is the result:
contact by email

You just need to replace yourname@yoursite.com with your real email. Of course, you can change the text to whatever you like.

No comments:

Post a Comment

Search & Win