Back to subject
HTML5/HTML Comments and Entities

Write Notes Without Showing Them

Practical lesson

Let's add comments and safely write characters that have a special meaning in HTML.

- An HTML comment starts with <!-- and ends with -->. - Comments are useful for notes to developers and for explaining unusual sections of markup. - Comments are still present in the page source, so never put passwords, private keys, or secrets inside them. - Some characters have special meaning in HTML markup and should be written with character references when you want them to appear as text. - &lt; displays a less-than sign, while &gt; displays a greater-than sign. - &amp; displays an ampersand. - &quot; can represent a quotation mark, and other named or numeric character references exist for additional symbols. - Do not replace every normal character with an entity when plain text is already correct; use character references when they are needed.

The practical goal is to know when you are writing HTML markup and when you are asking the browser to display a character as text.

Try it yourself
Code

Starter example

Code
<!-- Main heading -->
<h1>5 &lt; 10</h1>
<p>Terms &amp; Conditions</p>
<p>&copy; 2026</p>
Live preview