Skip to main content
HTML for Beginners
CHAPTER 09 Beginner

HTML Comments, Entities, and Symbols

Updated: May 10, 2026
5 min read

# HTML Comments, Entities, and Symbols

1. Introduction

Sometimes you need to write notes in your code that the browser shouldn't display. Sometimes you need to display special characters (like <, >, or &) that HTML might confuse for code. In this chapter, we cover Comments and Entities.

2. Learning Objectives

  • Write invisible comments in your HTML code.
  • Display reserved characters using HTML Entities.
  • Render special symbols like Copyright and Currency.

3. Detailed Explanations

HTML Comments

Comments are completely ignored by the browser. They are used to leave notes for yourself or other developers. They start with <!-- and end with -->.
html
123456789
<!-- This is a standard comment -->
<p>This paragraph is visible.</p>

<!-- 
  You can also write
  multi-line comments!
-->

<!-- <p>This paragraph is temporarily disabled and will not show up.</p> -->

HTML Entities (Reserved Characters)

If you want to display the < or > symbols on your website, you can't just type them, because HTML thinks you are starting a tag! Instead, you use Entities.

Entities start with an ampersand & and end with a semicolon ;.

html
12345
<!-- WRONG: The browser thinks <p> is a tag -->
<p>The tag for a paragraph is <p>.</p>

<!-- CORRECT: Using entities -->
<p>The tag for a paragraph is <p>.</p>

Common Reserved Entities:

  • Less than < = &lt;
  • Greater than > = &gt;
  • Ampersand & = &amp;
  • Double quote " = &quot;

Special Symbols

Entities are also used for symbols that aren't easily found on a keyboard.
html
123
<p>Copyright © 2024</p> <!-- Displays: Copyright © 2024 -->
<p>Price: €50</p>       <!-- Displays: Price: €50 -->
<p>Trademarks ™</p>    <!-- Displays: Trademarks ™ -->

Non-Breaking Space

Normally, HTML collapses multiple spaces into one. If you want to force an extra space, use the non-breaking space entity &nbsp;.
html
1
<p>10 km/h</p> <!-- Ensures &#039;10' and 'km/h' don't break onto separate lines -->
html
12345678910
<footer class="pricing-footer">
    <!-- Notice how we use entities for copyright and currency -->
    <p>© 2024 Acme Corp. All rights reserved.</p>
    <p>Premium plan available for just £99 / month!</p>
    
    <!-- 
      Developer Note: 
      Update the pricing above when the summer sale ends.
    -->
</footer>

5. MCQs

Q1: How do you write a comment in HTML? A) // This is a comment B) /* This is a comment */ C) <!-- This is a comment --> D) <! This is a comment !> *Answer: C*

6. Summary

Comments are your best friend for organizing large files. Entities ensure your text renders correctly without breaking the HTML parser, and they provide an easy way to inject professional symbols like &copy; into your web pages.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·