Loading...
Loading...
00:00:00

HTML Entities : Special Characters

HTML entities are special characters or symbols that are not directly supported by the standard keyboard. They are used to represent characters that are reserved in HTML, such as the less than symbol (<) and the ampersand (&), as well as characters from other alphabets and symbols.

HTML entities are specified using a special syntax, starting with an ampersand (&) and ending with a semicolon (;). For example, the entity for the less than symbol is &lt;, and the entity for the copyright symbol is &copy;.

There are two types of HTML entities: named entities and numeric entities.

  1. Named entities: Named entities are characters that are represented by a name, such as &copy; for the copyright symbol and &quot; for a double quotation mark. Named entities are easy to remember and are the preferred method for representing special characters in HTML.

  2. Numeric entities: Numeric entities are characters that are represented by a number, such as &#169; for the copyright symbol and &#34; for a double quotation mark. Numeric entities are less commonly used than named entities, but they can be useful for representing characters that are not available in named entities, or for representing characters from different character sets, such as Greek or Chinese characters.

Here are some examples of common HTML entities:

  • &copy;: Copyright symbol
  • &reg;: Registered trademark symbol
  • &quot;: Double quotation mark
  • &lt;: Less than symbol
  • &gt;: Greater than symbol
  • &euro;: Euro currency symbol
  • &yen;: Japanese yen symbol
  • &pound;: Pound sterling symbol
  • &sect;: Section symbol
  • &uuml;: Lowercase u with umlaut

Here is some example of HTML entities:

&lt;  <!-- this is less than sign -->
&gt;  <!-- this is greater than sign -->
&amp;  <!-- this is ampersand sign -->
&and;  <!-- this is and sign -->

It's important to note that HTML entities are not case-sensitive, so &copy; and &COPY; both represent the same character.

In conclusion, HTML entities are a useful and essential tool for displaying special characters and symbols in HTML. Whether you're using named entities or numeric entities, they provide a way to represent characters that are not available on a keyboard, or characters that have special meaning in HTML, in a standardized and cross-browser compatible manner.