Headings: [Skip]

Web-Design Tutorials by Dr Sam

XHTML Strict Specs, Part 2

Menu [Skip]

Character Entities / Numeric References

Reason 1

The & ampersand is a code in some mark-up languages and some scripting languages. The <> carets are codes in mark-up languages. If a caret were to be typed into the text of a sentence in a web-page, it would appear to be a part of the mark-up language and could throw a browser out whack. It can upset the display of an entire page. The same can occur with an & ampersand.

To avoid confusion, we should use the named character entity or the numeric character reference whenever we write any such symbols into the data of a web-page. (The data of a web-page are its text strings, including attribute values.)


Quotation from the W3C

There are three characters which should always appear in content as escapes, so that they do not interact with the syntax of the markup:

  • &lt; (<)
  • &gt; (>)
  • &amp; (&)

Source: Ishida, Richard, When to use escapes, in Tutorial: Character sets & encodings in XHTML, HTML and CSS, W3C Architecture Domain: Internationalization (W3C 2004-2007), available at www.w3.org/International/tutorials/tutorial-char-enc/



Web-Design Tutorials by Dr Sam
tutorials list
contact | about
© copyright, cc: by-nc-nd