Special Characters

Characters Entity References

Some special keyboard characters and symbols require a little extra care when working with HTML.  As well as HTML and CSS we have character entity references.

Character entities references are the way you put special letters, numbers and symbols on the web page.  A character entity reference consists of an ampersand (&), then a shorthand name for the character and are then closed with a semi-colon (;).

You can also use numeric values for character entity references – some characters only have a numeric value.

Non Breaking Spaces -  

Multiple white space in web pages is created using the ‘ ’ character entity reference.   When reviewing code on other people’s pages you may find something like this.


<p>&nbsp;</p>

This is simply an empty paragraph element with a non-breaking space added.

Some Useful Character Entity References

Character Name
© &copy;
® &reg;
&#8482;
Less Than < &lt;
Greater Than > &gt;
Non Breaking Space &nbsp;
Pound Sign £ &pound;
Yen ¥ &yen;
Euro € &euro;

Note: that if you want to use less than or greater than in your text you will need to use character entity references.  This is because they are used to define HTML elements and as such have reserved meaning in a HTML file.

Leave a Reply

*