Skip to content

Courses / HTML5 Mastery: Complete Beginner to Advanced Course / HTML Comments & Characters

586 people viewed this

HTML Comments & Characters

&name;

Examples

<p>Copyright &copy; 2026 Codementrix</p>

<p>HTML &amp; CSS</p>

<p>Price: &euro;99</p>

<p>This value is &lt; 100</p>

The browser displays the corresponding characters:

  • Copyright © 2026 Codementrix
  • HTML & CSS
  • Price: €99
  • This value is less than 100

Why the Semicolon Matters

Use the semicolon after a named character reference whenever possible. Some references have historical parsing rules that allow omission in certain contexts, but the result can be ambiguous or change depending on what follows.

Prefer:

&amp;copy;

When writing HTML that should display the literal text &copy;, the ampersand itself must be represented as a character reference.

For normal HTML content, write the actual character reference directly in the source:

<p>Copyright &copy; 2026</p>

This renders the copyright symbol rather than the literal sequence of characters &copy;.


5. Decimal and Hexadecimal Numeric Character References

Unicode characters can also be represented by numeric character references. This is useful when you do not know a named reference or when you want to identify a character by its Unicode code point.

Decimal Syntax

&#NUMBER;

Example:

<p>Copyright &#169; 2026</p>

The decimal number 169 corresponds to the copyright symbol ©.

Hexadecimal Syntax

&#xHEX_NUMBER;

Example:

Rate this course

5.0 · 1 rating

Stars show on this course. Your written note stays private.

Your stars