Video:Tips for Using Special Characters in HTML
with Dimitri LaBargeWant to learn some great tips for using special characters in HTML? This video will give you helpful information for creating special characters when building a web page or online article.
Transcript:Tips for Using Special Characters in HTML
Hi, this is Dimitri LaBarge for About.com, and today we're going to talk about tips for using special characters in HTML.
Types of Special Characters in HTML
There are literally thousands of special characters you can use in HTML to display everything from mathematical symbols to punctuation codes. Let's take a look at the three types of ways you can insert a special character into HTML.
Symbols in HTML
The first is the HTML - or friendly - version of a special character. There are symbols that HTML recognizes directly by typing in an ampersand, followed by a specific phrase, then completed by a semi-colon.
For instance, let's look at the non-breaking space. Browsers generally ignore extraneous spaces. In older coding days, there was no easy way to create a tab or spacing, so the non-breaking space was a way to force a browser to display a space, which helped in positioning. In friendly code, it would look like this: Don't forget the ampersand or semi-colon or you may confuse the browser. The ampersand opens up the friendly statement, and the semi-colon closes it.
Friendly Characters in HTML
Now, if you're going to use friendly characters, not all browsers render these in the same way. To ensure maximum compatibility, you need to tell the browser to use a standard character set specifically. This is called the unicode declaration, and you need to insert it into your standard META tag at the top of your page, like this:meta http-equiv="content-type" content="text/html;charset=utf-8" /That second content statement is what locks in your character set.
A second way - some say a more reliable way - is to use a decimal equivalent to display that special character. So for that non-breaking space, you would do the same thing - start with an ampersand or end with a semi-colon. It'll look like this: Note the pound sign preceding the decimal number.
Hexidecimal Code in HTML
And there's yet a third way for doing this - using hexidecimal code. Yes, once again, use the ampersand and semi-colon to open and close it. It'll look like this:#xA0;
You can't expect to keep all of this in your head - there are thousands of codes available. Fortunately, you can have easy reference by searching a code guide online, such as this one at About.com's own web design site. Note that each example displays every available version of a code, from friendly to numerical to hex - when available.
Thanks for watching. To learn more, visit us on the web at About.com.
