Chapter 20. Supplemental Topics

Reserved Characters and HTML Entities

Reserved Characters and HTML Entities
Tag:

As explained in Chapter 3, some special characters are not recognized in the content part of the HTML element. Those characters are called reserved characters.

An HTML entity is a special code used to represent a reserved character or special character that may not be displayed properly in the browser. HTML entities are sometimes called escape characters in the context of avoiding reserved characters.

Here is a list of key reserved characters and HTML entities for their replacement.

  • < (less than) : &lt;
  • > (greater than) : &gt;
  • & (ampersand) : &amp;
  • ' (single quotation mark) : &apos;
  • " (double quotation mark) : &quot;

Example – tags < > in HTML content

For example, in HTML documents, < and > are used as an HTML tag. Thus, when you use them as content, they won't be rendered in the browser like in the example below.

Reserved-Characters-and-HTML-Entities

When you want to use < or > in your content, you need to use &lt; (less-than) for < and &gt; (greater-than) for > like in the example below.

Reserved-Characters-and-HTML-Entities

As explained in Chapter 3, some special characters are not recognized in the content part of the HTML element. Those characters are called reserved characters.

An HTML entity is a special code used to represent a reserved character or special character that may not be displayed properly in the browser. HTML entities are sometimes called escape characters in the context of avoiding reserved characters.

Here is a list of key reserved characters and HTML entities for their replacement.

  • < (less than) : &lt;
  • > (greater than) : &gt;
  • & (ampersand) : &amp;
  • ' (single quotation mark) : &apos;
  • " (double quotation mark) : &quot;

Example – tags < > in HTML content

For example, in HTML documents, < and > are used as an HTML tag. Thus, when you use them as content, they won't be rendered in the browser like in the example below.

Reserved-Characters-and-HTML-Entities

When you want to use < or > in your content, you need to use &lt; (less-than) for < and &gt; (greater-than) for > like in the example below.

Reserved-Characters-and-HTML-Entities

Tag: