Section 5 . About Using Special Characters


5 . About Using Special Characters

BEFORE YOU BEGIN

2 Use HTML Tags


SEE ALSO

6 About Proper HTML Coding


There are certain characters and symbols that you can type into your word processor, but that won't display on a web page. For example, if you put the symbol for copyright into the text on a web page, it won't display properly. The same holds true for many other symbols and characters, such as letters in a foreign language such as ƒ § .

In order for those special characters and symbols to be displayed on a web page, you'll need to use special code. You denote the special code by prefacing it with a & symbol. Then following the & symbol, you use a name code or a numeric code that will tell the web browser exactly which symbol to display. For a name code, you just type in a name , but for a numeric code, you have to put a # after the & and before the number. Then directly after that name code or numeric code, you place a semicolon ; with no space between it and the code.

For example, to display the ‚ symbol on a web page, you would use the coding

©

or

©

Each will work, so whichever you want to use is up to you.

NOTE

There have been several versions of HTMLthe version is now up to 4.01and along the way the powers-that-be at the W3C introduce new tags and attributes into the language, and try to expunge some tags and attributes that it believes are no longer useful. A tag or attribute that the W3C discourages from being used is called deprecated . These tags and attributes will still work in browsers, but the W3C prefers that coders instead use new tags or techniques. Many deprecated tags, however, remain in widespread use. For example, the nearly ubiquitous FONT tag is a deprecated tag. The W3C prefers that coders use what are called style sheets to determine fonts, rather than using the FONT tag.


Note that not every special character has a name code as well as a numeric code, although all have numeric codes.

One other reason you'll want to use these special characters to display text is that browsers interpret certain symbol instructions or tags, and so won't display them. For example, let's say you want to display the text <P> on a web page. If you type in The tag <P> starts a new paragraph . your browser will display the following image, which is not at all what you want it to do.

Here's what your browser will display if you type The tag <P> starts a new paragraph.

Instead, you should type in The tag &lt;P&gt; starts a new paragraph ., which will display the following:

When you type The tag &lt;P&gt; starts a new paragraph. , this is what the browser displays.

For a list of special characters and symbols, and the codes you need to use for them, go to http://www.w3.org/TR/html401/sgml/entities.html.



Sams Teach Yourself Creating Web Pages All in One
Sams Teach Yourself Creating Web Pages All in One
ISBN: 0672326906
EAN: 2147483647
Year: 2006
Pages: 276

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net