HTML Entities
HTML Entities
HTML entities are special codes used to display characters that are reserved in HTML or not available on the keyboard.
They start with & and end with ;.
Why Use HTML Entities
-
To display reserved characters like
<,>,&. -
To display special symbols like ©, ®, €, ™.
-
To prevent HTML parsing errors when using symbols in text.
Common HTML Entities
| Character | Entity Name | Entity Number |
|---|---|---|
< |
< |
< |
> |
> |
> |
& |
& |
& |
" |
" |
" |
' |
' |
' |
| © | © |
© |
| ® | ® |
® |
| € | € |
€ |
| ™ | ™ |
™ |
Example Code
Output Preview
-
Reserved characters appear as:
< > & -
Special symbols appear as: © ® ™ €
Key Points
-
Always use entities for reserved HTML characters to prevent errors.
-
Use named entities for readability (
©) or numeric entities (©). -
Essential for special symbols, mathematical symbols, and accented letters in web pages.
