HTML Entities

Subject: html

๐Ÿ”ค HTML Entities

HTML Entities are special character codes used to display reserved or non-standard symbols in HTML documents. These ensure that certain characters like <, >, and & are interpreted correctly as text, not HTML code.


โ“ What Are HTML Entities?

  • Start with & and end with ;
  • Represent characters that are reserved, special, or non-ASCII

๐Ÿ“Œ Examples

CharacterEntity NameEntity NumberDescription
<&lt;&#60;Less-than symbol
>&gt;&#62;Greater-than symbol
&&amp;&#38;Ampersand
"&quot;&#34;Double quote
'&apos;&#39;Single quote (HTML5+)
ยฉ&copy;&#169;Copyright symbol
ยฎ&reg;&#174;Registered trademark
(space)&nbsp;&#160;Non-breaking space

๐ŸŽฏ Why Use HTML Entities?

  • โœ… Prevent HTML parsing errors for reserved symbols
  • โœ… Safely display symbols or special characters
  • โœ… Preserve formatting with non-breaking spaces
  • โœ… Improve accessibility and SEO

๐Ÿงพ Example: Using HTML Entities


๐Ÿ–ผ๏ธ Example with Styling: Common Entities Table


๐Ÿ“Œ Key Takeaway

  • Use HTML entities to safely render reserved or special characters.
  • They start with & and end with ;.
  • Essential for clean, valid HTML and preserving visual formatting.
  • Helps avoid errors when using characters like <, >, &, and " inside HTML content.