Symbols such as "<" have special meanings in HTML, so they are used in text.
In order to display the less-than sign (<) in HTML, we need to use the character entity.
Character entity
Some characters have special meanings in HTML, such as the less than sign (<), which defines the beginning of the HTML tag. If we want the browser to display these characters correctly, we must insert the character entities in the HTML source.
The character entity has three parts: a number (&), an entity name, or # and an entity number, and a semicolon (;).
To display the less-than sign in the HTML document, we need to write this:< or & #60;
The advantage of using entity names instead of entity numbers is that names are relatively easier to remember. The downside to this is that not all browsers support the latest entity names, but almost all browsers support the entity numbers very well.
Note: The entity is case sensitive.
Experiment with character entities yourself. (IE only supported)
<HTML><Body><P>This is a character entity:& #000;</P><P>you can try using another number (such as 169) in the edit window instead of 000, and then click the Tiy button to see the results. </P></Body></HTML>
Space
Spaces are the most common character entities in HTML.
Typically, HTML will cut the space in the document. If you enter 10 consecutive spaces in a document, the HTML will remove 9 of them. If you use it, you can add spaces to the document.
Most commonly used character entities
Show Results |
Description |
Entity name |
Entity number |
|
Space |
|
& #160; |
< |
Less than sign |
< |
& #60; |
> |
Greater than sign |
> |
& #62; |
& |
and number |
& |
& #38; |
" |
Quotes |
" |
& #34; |
‘ |
Apostrophe |
' (ie not supported) |
& #39; |
Some other commonly used character entities
Show Results |
Description |
Entity name |
Entity number |
¢ |
Score of |
¢ |
& #162; |
£ |
Pounds |
£ |
& #163; |
¥ |
Yen |
¥ |
& #165; |
§ |
Section |
§ |
& #167; |
© |
Copyright |
© |
& #169; |
® |
Registered trademarks |
® |
& #174; |
X |
Multiplication sign |
× |
& #215; |
÷ |
Division Sign |
÷ |
& #247; |