Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Some characters have special meaning in HTML so they cannot be used directly in a document, other characters may be unavailable on your keyboard. Character References allow you to include these characters in your document. These references are often referred to as character entities, but that's a misnomer. It's a subtle distinction that character entities are SGML declarations and HTML5 is no longer tied to SGML or its document type definitions. So these are called Character References because they refer to characters not SGML entities.
There are five characters that are particularly problematic in HTML. You'll need these often. The less than and greater than characters are named < and > or you can use the numeric entities decimal 60 or 62, or hexadecimal 3C and 3E. All of these References are introduced by an ampersand and terminated with a semicolon, and the Numeric References have a number sign or a pound sign and the Hexadecimal References also have letter x.
Because the ampersand is used to introduce a reference, the ampersand itself is problematic and you can put ampersand in your document by typing the & or by using the Numeric References. The quote marks, the single quote which is sometimes called an apostrophe, or the double quote, can also be problematic when you want to include them in quoted content, like the value of an attribute. There are huge numbers of other characters available.
In previous versions of HTML there were a few hundred named references, in HTML5 there are about 2000. Here is a small sampling. Let's make a working copy of references.html and I'm going to rename that to references-working.html. Now I'll open that in my text editor and you can see we have a little bit of CSS at the top there and then we have the body of the document. And if I open this in the browser, see what it looks like here, Firefox, and there are our HTML character references.
And this is the styling that's in the CSS there. I'm just highlighting these paragraphs that have the character references in them. So in the first display paragraph you'll notice that it's in this monospace font, that's because I've it wrapped in the code element. And then I'm using Character References less than and greater than, both at the beginning and the end in order to display this HTML snippet here. So I have a paragraph and it says, Content goes here, but you'll notice that that's not actually getting interpreted in the document because I'm using these character references instead.
If I had actually put in the less than and greater than sign, and let's just go ahead and do that here, so I'm replacing these Character References with the actual less than and greater than signs. You'll see that this gets interpreted as a paragraph, and when I reload over here I just get this separate paragraph that says, Content goes here. It's really not showing it the way that I wanted it to be shown. So I'll go ahead and I'll put those Character References back and save it and reload it, and now I'm able to display an actual snippet of HTML in an HTML document without those characters getting interpreted.
So that's one of the major uses of Character References and you'll see that used a lot to display characters that would otherwise be interpreted. There are, as it says here, many other interesting characters available. Like I said there are about 2000 of the named entities and even more available as numeric entities; virtually all of Unicode is available numeric entities, assuming that your target browser and character encoding will display it. These are just a few. I've some accented a characters here, and you see those are those ones there.
I have a couple of ligatures, AE ligature, uppercase and lowercase. I have this approximate and approximately equals to signs and they are here, approximate and approximately equals to, and I've some Greek letters. I have Alpha, Beta, Delta, Gamma, Omega and Mu, and there they are in their character entities. I also have some other symbols Copyright, Registered Trademark, paragraph and @ sign, dollar sign, cent sign, euro sign; some of these are available on keyboards, obviously we usually have the @ sign available.
Its character entity is commercial at c-o-m-m-a-t, dollar, cent and Euro depending on where you're in the world. Some of those will be available and some of those will not be available on your keyboard; the male, female sign, some other symbols. And then down here on the last line I have some script versions of regular Latin Characters and you notice also have horizontal ellipse, that's this h-e-l-l-i-p and that's what all of those look like. Of course there are many, many more. There is a complete list of the HTML5 named references available on WHATWG website, of course you can use Numeric References for any Unicode characters.
And it's always a good idea to make sure that your target audience has a good chance of displaying whatever characters you include in your documents.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 98813 Viewers
61 Video lessons · 86125 Viewers
71 Video lessons · 69988 Viewers
56 Video lessons · 102231 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.