9. Use the encoded equivalents for a left angle bracket and
ampersand within content. When XHTML encounters a left
angle-bracket, < (also known as the less-than symbol), it quite
reasonably assumes you are starting a tag. But what if you actually
want that symbol to appear in your content? The answer is
to encode it using an entity. An entity is a short string of characters
that represents a single character; an entity causes XHTML
to interpret and display the character correctly and not to confuse
it with markup. The entity for the left angle-bracket/lessthan
symbol is <??”remember lt stands for less than.
Entities not only help avoid parsing errors like the one just
mentioned, but they also enable certain symbols to be displayed
at all, such as © for the copyright symbol (?©). Every
symbolic entity begins with an ampersand (&) and ends with
a semicolon (;). Because of this, XHTML regards ampersands
in your code as the start of entities, so you must also encode
ampersands as entities when you want them to appear in your
content; the ampersand entity is &.
A good rule of thumb is that if a character you want to use is
not printed on the keys of your keyboard (such as ?©, ?®, ?©, or ??),
you need to use an entity in your markup.
There are some 50,000 entities in total, which encompass the
character sets of most of the world??™s major languages, but you can
?¬? nd a shorter list of the commonly used entities at the Web Design
Group site (www.
Pages:
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45