HTML character entities

HTML Character Entities employ a code representation of a character that’s used when you want to include a special character (such as @¥, or π) or a character that HTML would usually read as an instruction (such as > or <) in your HTML code.

The format consists of an identifier for the specific code with an ampersand prefix and a semi-colon suffix. Here’s an example based on the first paragraph of this post showing what a line of code with HTML Character Entities included looks like. The character entities have been highlighted:


HTML Character Entities are used when you want to include a special character (such as &commat;, &yen;, or &pi;) or a character that HTML would usually read as an instruction (such as &lt; or &gt;) in your HTML code.
              

Commonly used codes include:

  • < = &lt;
  • > = &gt;
  • & = &amp;
  • / = &sol;
  • @ = &commat;
  • © = &copy;
  • ® = &reg;
  • £ = &pound;
  • ½ = &half;
  • ñ = &ntilde;

To see more examples of the wide range of available HTML Character Entity codes, including non-English alphabets, a good place to visit is the W3C website which has a table of characters and their codes. However, some browsers may not support all codes, so it’s worth spending a little time checking that any code you want to include is widely supported.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to Top