Some characters, such as less than signs, have special meanings in HTML, so they cannot be used directly in the text.
In order to display the less than sign in the HTML document, we need to use escape characters.
The actual escape character means that some characters are used to mark, and some other characters or character combinations are defined in the browser to replace these characters that have been used as tags, this allows normal display of these characters in the text.
1) escape characters
Some characters have special meanings in HTML, such as signs smaller than <, which are used to define the beginning of an HTML Tag. If you want the browser to accurately display this type of characters, you must use escape characters in the HTML source code.
An escape character consists of three parts: one with the symbol &, one entity name or, one well character # with an entity number, followed by a semicolon; (that is, & entity-name; or & # entity-number ;).
In an HTML document, the following code is displayed:& Lt; Or& #60;.
Object names are easier to remember than entity numbers. However, the disadvantage is that a few Entity names cannot be supported by all browsers. However, most browsers support Entity numbers very well.
Note:The entity name or entity number is case sensitive.
The following example allows you to practice escape characters (only in the IE browser): escape characters.
2) Non-wrap Spaces
In HTML documents, escape characters are often used as non-line breaks (we usually refer to spaces and spaces ). In general, HTML ignores spaces in your text ). In your document, if you write 10 spaces, the HTML will also remove 9 spaces, that is, no matter how many spaces, only one space is processed. To add spaces (blank spaces) to your document, you can use escape characters & nbsp ;.
3) common escape characters:
Result |
Description |
Entity name |
Entity number |
|
Non-wrap Space |
& Nbsp; |
& #160; |
< |
Yu no. |
& Lt; |
& #60; |
> |
Yu no. |
& Gt; |
& #62; |
& |
And symbol |
& Amp; |
& #38; |
" |
Quotation marks |
& Quot; |
& Amp; #34; |
' |
Single quotes |
& Apos; (cannot be executed in IE browser) |
& Amp; #39; |
4) supplemented by common escape characters:
Result |
Description |
Entity name |
Entity number |
* |
Circle character |
& Cent; |
& #162; |
* |
Pound symbol |
& Pound; |
& #163; |
* |
RMB symbol |
& Yen; |
& #165; |
§ |
Section character |
& Sect; |
& #167; |
* |
Copyright (ownership) |
& Copy; |
& #169; |
* |
Registered Trademark |
& Reg; |
& #174; |
× |
Multiplication number |
& Times; |
& #215; |
Bytes |
Division Number |
& Divide; |
& #247; |
Note: The above mark * is not displayed here (some messy code is actually displayed), so use * instead. You can use the escape character on the right of the table in your HTML document.