<!-- Outer comment
<!-- Inner comment -->
Outer comment continues -->This is not a reliable way to create nested comments. The inner closing delimiter can terminate the outer comment unexpectedly, causing malformed markup or unexpected visible text.
Use a single comment instead:
<!-- Notes about the course section go here. -->Comments and Security
Comments are not a security boundary. A user can inspect the source delivered to their browser. Never put secrets, passwords, private tokens, internal credentials, or sensitive personal information in HTML comments.
Best practice: Write comments that explain why code exists when the purpose is not obvious. Avoid comments that merely repeat what the code already says.
3. What Are Special Characters in HTML?
Some characters have a special meaning in HTML markup. For example, angle brackets identify tags, while the ampersand begins a character reference in relevant contexts.
Consider this text:
5 < 10If you want to display the less-than symbol as text inside ordinary HTML content, use a character reference:
<p>5 < 10</p>The browser displays:
5 < 10
Similarly, to display a greater-than symbol, you can use >. To display an ampersand, use &.
Common HTML Character References
| Character | HTML reference | Common use |
|---|---|---|
| < | < |
Display a less-than sign |
| > | > |
Display a greater-than sign |
| & | & |
Display an ampersand |
| " | " |
Display a double quotation mark |
| ' | ' |
Display an apostrophe |
| Non-breaking space | |
Prevent a line break at that space |
| © | © |
Copyright symbol |
| ® | ® |
Registered trademark symbol |
| ™ | ™ |
Trademark symbol |
| € | € |
Euro currency symbol |
| — | — |
Em dash |
| – | – |
En dash |
HTML defines many more named character references. Use them when they improve readability or when the character would otherwise conflict with HTML syntax.
4. Named Character References
A named character reference uses a predefined name that begins with an ampersand and usually ends with a semicolon.