HTML character entities
- Previous Page HTML5 Coding Conventions
- Next Page HTML Symbols
Reserved characters in HTML must be replaced with character entities.
HTML Entities
In HTML, some characters are reserved.
In HTML, we cannot use the less than symbol (<) and the greater than symbol (>), because browsers may mistakenly think they are tags.
If we want to display reserved characters correctly, we must use character entities (character entities) in the HTML source code.
Character entities are similar to this:
&entity_name; or entity_number;
To display the less than symbol, we must write it like this: < or <
Tip:The advantage of using entity names instead of numbers is that names are easy to remember. However, the disadvantage is that browsers may not support all entity names (while support for entity numbers is quite good).
Non-breaking space
The commonly used character entities in HTML are non-breaking spaces ( ).
Browsers always truncate spaces in HTML pages. If you write 10 spaces in the text, the browser will delete 9 of them before displaying the page. To increase the number of spaces on the page, you need to use the character entity.
HTML Example Examples
Experiment with HTML entity symbols:Try It Yourself
Useful Character Entities in HTML
Note:Entity Names Are Case Sensitive!
Display Result | Description | Entity Name | Entity Number |
---|---|---|---|
Space | |||
< | Less Than Symbol | < | < |
> | Greater Than Symbol | > | > |
& | And Symbol | & | & |
" | Quotation Marks | " | " |
' | Apostrophe | ' (IE does not support) | ' |
¢ | Cent (cent) | ¢ | ¢ |
£ | Pound (pound) | £ | £ |
¥ | Yen (yen) | ¥ | ¥ |
€ | Euro (euro) | € | € |
§ | Section | § | § |
© | Copyright (copyright) | © | © |
® | Registered Trademark | ® | ® |
™ | Trademark | ™ | ™ |
× | Multiplication Symbol | × | × |
÷ | Division Symbol | ÷ | ÷ |
For a complete reference of entity symbols, please visit our HTML Entity Symbol Reference Manual.
- Previous Page HTML5 Coding Conventions
- Next Page HTML Symbols