HOME C C++ PYTHON JAVA HTML CSS JAVASCRIPT BOOTSTRAP JQUERY REACT PHP SQL AJAX JSON DATA SCIENCE AI

HTML Entities

HTML entities are special codes used to represent reserved characters, as well as characters that may not easily be typed or displayed in HTML documents. In HTML, certain characters have special meanings, such as the less-than sign ("<") and the greater-than sign (">"), which are used to define HTML tags. If you want to display these characters as part of your content rather than as markup, or if you want to include characters that don't have a direct keyboard representation, you can use HTML entities to achieve this.

HTML entities are written in the form &entity_name; or &#entity_number;. For example:

  • &lt; represents the less-than sign ("<").
  • &gt; represents the greater-than sign (">").
  • &amp; represents the ampersand character ("&").
  • &quot; represents the double quotation mark (").
  • &copy; represents the copyright symbol ("©").

There are also numeric character references, such as &#169; for the copyright symbol, where the number corresponds to the character's Unicode code point.

HTML Character Entities

HTML character entities are special codes used to represent reserved characters, as well as characters that may not easily be typed or displayed in HTML documents. These entities are useful for displaying characters that have special meanings in HTML, ensuring proper rendering and interpretation by browsers.

Reserved Characters:

  • &lt; represents the less-than sign ("<").
  • &gt; represents the greater-than sign (">").
  • &amp; represents the ampersand character ("&").
  • &quot; represents the double quotation mark (").
  • &copy; represents the copyright symbol ("©").

Mathematical Symbols:

  • &plus; represents the less-than sign ("+").
  • &minus; represents the greater-than sign ("-").
  • &times; represents the ampersand character ("x").
  • &divide; represents the double quotation mark ("÷").

Example

&entity_name;
You can click on above box to edit the code and run again.

Output


Entity numbers look like this:

Example


&#entity_number;
You can click on above box to edit the code and run again.

Output


To display a less than sign (<) we must write: &lt; or &#60;

Non-breaking Space

A non-breaking space is a special type of space character that is used in HTML and other markup languages to prevent the browser or text editor from breaking the line at that particular space. In HTML, the non-breaking space is represented by the entity &nbsp; or the numeric character reference &#160;

Some Useful HTML Character Entities

Result Description Name Number
non-breaking space &nbsp; &#160;
< less than &lt; &#60;
> greater than &gt; &#62;
& ampersand &amp; &#38;
" double quotation mark &quot; &#34;
' single quotation mark &apos; &#39;
¢ cent &cent; &#162;
£ pound &pound; &#163;
¥ yen &yen; &#165;
euro &euro; &#8364;
© copyright &copy; &#169;
® trademark &reg; &#174;