HTML: Working with Special Characters - How to Create a Mailto Link
(Page 4 of 5 )
Our last link is the Mailto, which opens the user's email and allows them to send you a message. You can opt for it to include a subject line, as we will do in the sample below:
<html>
<body>
<p>
<a href="mailto:someone@google.com?subject=Hello%20Buddy">
Email Me</a>
</p>
</body>
</html>
This code creates a link inside the words Email Me and creates a subject line for the email that reads: Hello Buddy. Note that when you put a space in between words for your subject, you must use %20 to do so.
Entities
Entities are characters in HTML that are reserved for special purposes. Common examples are the &, >,<, double quotation (“) and single quotation (‘). Since these special characters are reserved in HTML, you cannot simply write them as text on your web page, as the browser will misinterpret them. Never fear though, because I am going to teach you how to force your browser to accept them. Take that Internet Exploder!
<html>
<body>
<p>James Payne's Mr. T I Pity the Fool Cereal ®</p>
</body>
</html>
The above code will display the following text in your browser:
James Payne's Mr. T I Pity the Fool Cereal ®
The code “®” tells the browser to place a Register symbol into the paragraph.
You will note that there are two ways to enter special characters in HTML. You can do it either by using the Entity Number, as in the above example, or by using the Entity Name, as shown below:
<html>
<body>
<p>James Payne's Mr. T I Pity the Fool Cereal ®</p>
</body>
</html>
The up side to using the Entity Name is that it is easier to remember. Unfortunately though, not all browsers support every Entity Name. For this reason it is typically better to use an Entity Number instead.
Next: Special Characters/Entities in HTML >>
More HTML Articles
More By James Payne