Your Ad Here

Using Symbols and Special Characters in an HTML Document

Placing ordinary text on a Web page is as simple as creating an HTML document and entering the

letters (A–Z, a–z) and numbers (0–9) it finds in the HTML document. There are, however, certain
special characters and symbols that text-editor applications let you type into the document, but the
Web browser will not display on the Web page. Fortunately, HTML provides a text notation you can
use to tell the Web browser to display certain commonly used special characters and lets you enter a
numerical code for the rest.
Say, for example, you create a Web page, and you want to display a copyright symbol
() to indicate that certain items on the page and perhaps the overall design are protected
under United States copyright laws. To get the Web browser to display the copyright symbol, you
must enter the specific numeric value that represents the symbol. In a computer, each letter, number,
and symbol is stored as a unique numeric value known as the character’s ASCII code. To display a
symbol such as the copyright on a Web page, you enter the symbol’s unique value (that is, its ASCII
code) into the Web page HTML.
For example, the numeric value of the copyright symbol is 169. To instruct the Web browser to
display the character represented by the ASCII value 169, precede the character value with an ampersand
(&) pound sign (#) combination and place a semicolon (;) after the code. Thus, to tell the Web browser
to display the copyright symbol on the Web page, you would enter © into the Web page HTML.
For the more commonly used symbols, HTML simplifies the process by letting you use a text code
as opposed to a number to represent the symbol. For example, the character notation for the copyright
symbol is ©.
The following code illustrates the use of the copyright symbol in an HTML document. To display
a special character, the &#xxx; (where xxx represents the ASCII value of the special character) informs
the browser which special character to display within the Web document onscreen. Figure 1-17 shows
the results of using a Web browser to display the following HTML:
<html>
<head>
<title> Copyright example </title>
</head>
<body>
<p>The copyright symbol &#169; indicates the
product falls under the protective umbrella
of copyright as defined by the United States.</p>
</body>
</html>


0 comments:

Post a Comment

Popular Posts

Recent posts