HTML5
HTML5

HTML Comments and Entities

Comments are notes for people who read the code. The browser does not show them as page content. Write a comment like <!-- This is a note -->. HTML entities let you write special characters safely. For example, &lt; displays a less-than sign, &gt; displays a greater-than sign, &amp; displays an ampersand, and &copy; displays the copyright symbol. You may need an entity when a character could be confused with HTML syntax or when you want a named symbol.

Why this matters

  • ·Comments make code easier to explain and maintain.
  • ·Entities let you display special characters as text.
  • ·They are useful when text contains HTML-looking symbols.

Common mistakes

  • ·Do not put passwords or secrets in comments because visitors can still view the source.
  • ·Do not use entities when normal text already works and readability would be hurt.
  • ·Remember that comments are hidden visually, not truly private.
Your codeHTML
Live preview

Frequently asked questions

No. They are notes in the HTML source.

Practice questions

Question 1

Write a comment above a heading.

Your codeHTML
Live preview

Question 2

Display "5 < 10" as text.

Your codeHTML
Live preview

Quick check

Just for this topic answer honestly, then check yourself.

1 / 3

Which syntax creates a comment?