HTML Entities

HTML entities are used to display reserved or special characters that cannot be typed directly in HTML.


Why Entities Are Needed

Some characters have special meaning in HTML, such as < and >.

Example (incorrect):

<p>5 < 10</p>

Correct using entity:

<p>5 &lt; 10</p>

Common HTML Entities

&amp;  <!-- & -->
&lt;   <!-- < -->
&gt;   <!-- > -->
&quot; <!-- " -->
&apos; <!-- ' -->

Important Notes

  • Entities start with & and end with ;
  • Prevents HTML parsing issues
  • Improves content accuracy