HTML escape tag is a special tag that can be used to escape special characters in HTML code into ordinary text characters to prevent these special characters from being interpreted as HTML code by the browser. When writing HTML code, you often need to use some special characters, such as the less than sign, the greater than sign, quotation marks, & signs, etc. If they are not escaped into ordinary text characters, it will cause HTML format errors and affect the normal display of the page. This article will introduce the use of HTML escape tags and common escape characters.
The format of the HTML escape tag is "&" "escape character name" ";", where the escape character name is the entity name or entity number of the character in HTML. The following lists some commonly used HTML escape characters:
The method of using HTML escape tags is very simple. You only need to add an escape tag before the characters that need to be escaped. For example, if you want to To write a sentence in HTML: Today is a
Today is a <good> day!
The effect displayed in the browser is: Today is a
It should be noted that some special characters do not have corresponding entity names or entity numbers in HTML. In this case, Unicode encoding needs to be used instead of escape tags. For example, if you want to use the copyright symbol "©" in HTML , the following Unicode encoding should be used:
©
The effect displayed in the browser is: "©".
In addition to the common HTML escape characters mentioned above, there are also some very practical escape characters Definition tag.
In short, HTML escape tags are used when writing HTML It is very practical when coding. It can avoid some common mistakes and also make the code more beautiful. I hope this article can help everyone better master the use of HTML escape tags.
The above is the detailed content of html escape tag. For more information, please follow other related articles on the PHP Chinese website!