- Some characters are reserved in HTML. For eg.
- The less than symbol (<)
- The greater than symbol (>)
- If we use to try to output directly in HTML code, the browser will get confused.
- For solving this we will use HTML entities.
- HTML entities are used to display reserved characters in HTML.
- The characters that are not on the keyboard can also replace with entities.
- There are two ways to use entities.
- The entity name should start with '&'' and end with a semicolon ';'
eg., < (This is the entity for less than symbol). This will add '<' to the output.
- Preface the entity number with & and end with.
eg., <
- The entity name is so easy to remember. But all the browsers will not support entity number. But for the support numbers are good.
- Entity names are case sensitive.
- All the symbols will not have the entity name. You must use an entity name to create them.
- Some common entity names:
-   - Space
- & - @
- < - <
- > - >
- © - c(rounded)
Example:
<html>
<head>
<title>This is for testing</title>
</head>
<body>
<p>The heading tag in html looks like <h2></p>
</body>
</html>