English 中文(简体)
HTML - Entities
  • 时间:2024-09-17

HTML - Entities


Previous Page Next Page  

Some characters are reserved in HTML and they have special meaning when used in HTML document. For example, you cannot use the greater than and less than signs or angle brackets within your HTML text because the browser will treat them differently and will try to draw a meaning related to HTML tag.

HTML processors must support following five special characters psted in the table that follows.

Symbol Description Entity Name Number Code
" quotation mark " "
apostrophe  ' '
& ampersand & &
< less-than &lt; &#60;
> greater-than &gt; &#62;

Example

If you want to write <span id = "character"> as a code then you will have to write as follows −

<!DOCTYPE html>
<html>

   <head>
      <title>HTML Entities</title>
   </head>

   <body>
      &lt;span id = &quot;character&quot;&gt;
   </body>

</html>

This will produce the following result −