April 24, 2009

0 HTML CHARACTER ENTITIES

HTML CHARACTER ENTITIES

Some characters like the < character, have a special meaning in HTML, and therefore cannot be used in the text.

To display a less than sign (<) in HTML, we have to use a character entity.

CHARACTER ENTITIES

Some characters have a special meaning in HTML, like the less than sign (<) that defines the start of an HTML tag.If we want the browser to actually display these characters we must insert CHARACTER ENTITIES in the HTML source.

A character entity has three parts : an ampersand (%), an entity name or a # and
an entity number, and finally a semicolon (;)

To display a less than sign in an HTML document we must write: < or <

The advantage of using a name instead of a number is that a name is easier to remember. The disadvantage is that not all browsers support the newest entity names, while the support for entity numbers is good in almost all browsers.

Note that the entities are case sensitive.

This tutorial demonstrates and experiment with character entities.

<html>
<body>
<p>This is a character entity: & # 000;</p>
<p>Try to substitute the number (555) in the edit window with another number (e.g 169) and press the "Edit.
the text and click me" button to view the result.
</p>
</body>
</html>



0 comments:

Post a Comment

Blogger Themes

 
Powered by Blogger