In HTML, <, >, & and so on have special meanings (<, >, used for link tag, & used for escape), and cannot be used directly. These symbols are not displayed in the web page we finally see. What should we do if we want to display these symbols in the web page?
This is about the HTML escape sequence.
Escape sequence is also called character entity. There are two reasons to define escape strings in HTML: the first reason is that symbols like “<” and “>” have been used to represent HTML tags, so they cannot be used directly as symbols in text. In order to use these symbols in HTML documents, you need to define its escape string. When the interpreter encounters such a string, it interprets it as a real character. When inputting escape strings, the rules of letter case should be strictly observed. The second reason is that some characters are not defined in the ASCII character set, so they need to be represented by escape strings.
Escape sequence, or character entity, is divided into three parts: the first part is a & symbol, which is called ampersand in English; The second part is the name of the entity or the number of the entity; The third part is a semicolon.
For example, to display the less than sign (<), you can write & lt; Or 60.
The advantage of using an entity name is that it is easy to understand. When you look at lt, you can guess the meaning of less than, but the disadvantage is that not all browsers support the latest entity name. The entity number can be handled by all kinds of browsers.
Tip: entity names are case sensitive.
Note: the same symbol can be referenced in two ways: “entity name” and “entity number”. The advantage of “entity name” is that it is easy to remember, but it can not guarantee that all browsers can recognize it smoothly. However, “entity number” has no such worry, but it is not convenient to remember.
Most commonly used character entities
Character entities displays the description entity name and entity number
|A half square blank|| |
|A big blank|| |
|Blank space with continuous lines|| |
|“||Double quotation marks||"||"|