HTML and CSS Reference
In-Depth Information
less-than or opening bracket symbol ( < ). In HTML, it normally signifies
the start of a tag, so if you insert it simply as part of your text, the
browser will get confused and probably misinterpret your document.
For both HTML and XHTML, the ampersand character ( & ) instructs the
browser to use a special character, formally known as a character en-
tity . For example, the command &lt; inserts that pesky less-than sym-
bol into the rendered text and the browser does not confuse it to mean
the start of a tag. Similarly, &gt; inserts the greater-than symbol, and
&amp; inserts an ampersand. There can be no spaces between the am-
persand, the entity name, and the required, trailing semicolon. (Semi-
colons aren't special characters; you don't need to use an ampersand
sequence to display a semicolon normally.) [ Handling Special Charac-
ters, 16.3.7 ]
You also may replace the entity name after the ampersand with a pound
symbol ( # ) and a decimal value corresponding to the entity's position in
the character set. Hence, the sequence &#60; does the same thing as
&lt; and represents the less-than symbol. In fact, you could substitute
all the normal content characters within an HTML document with am-
persand special characters, such as &#65; for the capital letter A or &#97;
for its lowercase version, but that would be silly. You can find a com-
plete listing of all characters and their names and numerical equivalents
in Appendix F .
Keep in mind that not all special characters can be rendered by all
browsers. Some browsers just ignore many of the special characters;
with others, the characters aren't available in the character sets on a
specific platform. Be sure to test your documents on a range of browsers
before electing to use some of the more obscure character entities.
Comments are another type of textual content that appears in the
source HTML document but is not rendered by the user's browser. Com-
ments fall between the special <! and > markup elements. Browsers
Search WWH ::

Custom Search